• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

SQL, (remote) WMI, @WMIQUERY

#1
Having enabled remote WMI on my work computer, being connected via a VPN, and having the same credentials on both machines, I can, with an elevated PowerShell, do the likes of
Code:
V:\> Get-WmiObject -Namespace "root\cimv2" -query 'select commandline from Win32_process where ProcessId = 3752' -Impersonation 3 -ComputerName lucky

CommandLine  : d:\tc14\tcc.exe /q
Most ok that command line I got from the web. I know very little about SQL.

On the local computer, I can do the same with @WMI.
Code:
v:\> echo %@wmi[root\cimv2,select CommandLine from Win32_process where ProcessId
= ...]
Does anyone know if there's a syntax for specifying the remote machine with @WMI?
 
#3
Got it! This works.
Code:
v:\> wmiquery \\lucky\root\CIMV2 "SELECT CommandLine FROM Win32_Process WHERE ProcessId = 4048"
"D:\TC16\tcc.exe"
That gives me some hope that it will also work with @WMI, but when I try the obvious (?), I get
Code:
v:\> echo %@wmi[\\lucky\root\CIMV2,"SELECT CommandLine FROM Win32_Process WHERE ProcessId = 4048"]
Error (SYS): Invalid parameter
Rex, should it work with @WMI?
 
Top Bottom