wmic - Windows Management Instrumentation commandline
win2k3, XP, Win2K, Windows NT 4.0, Windows Me, and Windows 9x. Can be used on a remote machine as well...
The first time you start WMIC, Windows installs it on the computer and displays the WMIC command prompt, wmic:root\cli>. At this prompt, you enter commands interactively. For example, the command
process where name='outlook.exe' call terminate
"batch" mode allows you to run commands from a cmd.exe or .bat
wmic /node:SERVER1 printer list status
NOTE: that if the name contains special characters like '-' or '/' you must use
'computer-name'
e.g. wmic /node:'my-server' printer list status
USEFUL WMIC COMMANDS
wmic /? > wmic-readme.txt //all of the wmic options!
/node:@serverlist.txt process get CSName, name, workingsetsize
/failfast:on //won't wait for an unresponsive host
/output:c:\os.csv os get /all /format:csv //output to csv format /output:c:\os1.html os get /all /format:htable.xsl //output to html/xsl format
wmic /interactive:off /node:"computer-name" PROCESS call create "notepad.exe"
wmic /interactive:off /node:"computer-name" PROCESS WHERE NAME="notepad.exe" CALL Terminate
WMIC nicconfig get description, DHCPEnabled, index WMIC NICCONFIG WHERE Index=1 CALL Enable DHCP
wmic service where "caption='Virtual Server'" call changestartmode disabled
wmic /interactive:off /Node:@serverlist.txt os WHERE Primary=True call reboot
wmic /node:%computername% LogicalDisk Where DriveType="3" Get DeviceID,FreeSpace
for human readability: ForEach-Object -Process {($_.FreeSpace)/1024/1024/1024}
wmic /node:'$Computer Name$' qfe GET description,hotfixid,installedby,installedon,servicepackineffect
wmic useraccount list brief
process get name, workingsetsize
wmic memphysical
http://technet.microsoft.com/en-us/library/bb742610.aspx