Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

WMIQUERY vs. @WMI?

May
12,846
164
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?
 
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
 
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
 
Back
Top