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

WMIQUERY vs. @WMI?

Discussion in 'Support' started by vefatica, Jun 24, 2014.

  1. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,079
    Likes Received:
    30
    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. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,079
    Likes Received:
    30
    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. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,079
    Likes Received:
    30
    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
     
  4. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,040
    Likes Received:
    84
    No. @WMI queries the local machine.
     

Share This Page