Wednesday, April 16, 2008

Various WMIC commands

Find the Serial number of a computer
wmic /node:WSNAME1 path win32_computersystemproduct get identifyingnumber
wmic /node:WSNAME1 csproduct get identifyingnumber

Query Active Directory using WMI
WMIC /NAMESPACE:\\root\directory\ldap PATH ds_user WHERE ds_cn="user1" GET ds_department /VALUE

WMIC returns error "Invalid Global Switch."
This is caused by the computer name containing the "-" special character.
Enclose the computer name with double quotes.

1 comment:

Anonymous said...

Thank you for this. I was fighting with getting it to work by name alone and not ip.