WMIQUERY vs. @WMI?

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#1
This remote query works.
Code:
v:\> wmiquery \\lucky\root\CIMV2 "SELECT CommandLine FROM Win32_Process WHERE ProcessId = 4048"
"D:\TC16\tcc.exe"
This one doesn't.
Code:
v:\> echo %@wmi[\\lucky\root\CIMV2,"SELECT CommandLine FROM Win32_Process WHERE ProcessId = 4048"]
Error (SYS): Invalid parameter
Should I expect @WMI to work for remote queries?
 
#2
P.S. When I give a namespace that I don't expect to work, I get an error message whiich apparently is WMI-specific. When I give the namespace I expect to work, I get a more generic error message, suggesting it didn't even get as far as WMI.
Code:
v:\> wmiquery \\lucky\root\CIMV2 "SELECT Name FROM Win32_ComputerSystem"
LUCKY

v:\> echo %@wmi[lucky\root\CIMV2,"SELECT Name FROM Win32_ComputerSystem"]
Error (SYS): Invalid namespace
v:\> echo %@wmi[\lucky\root\CIMV2,"SELECT Name FROM Win32_ComputerSystem"]
Error (SYS): Invalid namespace
v:\> echo %@wmi[\\lucky\root\CIMV2,"SELECT Name FROM Win32_ComputerSystem"]
Error (SYS): Invalid parameter
 
#3
You can test this on the local computer. Below, ZZ is the local computer.
Code:
v:\> wmiquery \\zz\root\CIMV2 "SELECT Name FROM Win32_ComputerSystem"
ZZ

v:\> echo %@wmi[\\zz\root\CIMV2,"SELECT Name FROM Win32_ComputerSystem"]
Error (SYS): Invalid parameter