wmic output well formed xml on remote queries

Posted by Mervin on Server Fault See other posts from Server Fault or by Mervin
Published on 2011-11-14T08:57:47Z Indexed on 2011/11/14 9:56 UTC
Read the original article Hit count: 416

Filed under:
|
|
|

I want to use the WMI command line tool (wmic) to get information about windows computers on the network and output it as valid xml.

However, I can't seem to find the right way to do this as the outputted xml currently contains invalid tokens for which I think I should use the /TRANSLATE:basicxml switch.

The command:

wmic /NODE:"tech-demo" /IMPLEVEL:Impersonate /USER:MyUser /PASSWORD:MyPassword /PRIVILEGES:DISABLE /AUTHLEVEL:Pkt /AUTHORITY:"ntlmdomain:companydomain.local" PATH Win32_LogicalDisk GET * /FORMAT:rawxml

This command runs but returns invalid xml tokens ('<' and '>' I think? edit: it appears to fail parsing at )

When I add the translate switch I get the message:

Can not use credentials for local connections

a bit strange that it tries to query the local pc when I add the switch..

Help would be greatly appreciated.

© Server Fault or respective owner

Related posts about Windows

Related posts about wmi