WMI Command Line Interface

Incase you didn't know, there is a command line interface for WMI - wmic.

Some documentation is here http://technet.microsoft.com/en-us/library/bb491034.aspx, and http://technet.microsoft.com/en-us/library/bb742610.aspx.

You can write simple scripts to manage just about anything that your might write a short VB program for – printers, accounts, scheduled jobs, processes, etc. It has a lot of aliases you can use that are documented in the online help, but you can use the actual class commands.  If you just enter wmic on the command line and let it prompt, it sets your command window width to 1500 so output from most commands will not wrap.  You can enter /? At any point for help.  Some examples: [more]

  • wmic process get Caption,Commandline,Processid
  • wmic /node:server1 cpu get description, manufacturer, maxclockspeed, revision
  • wmic process where name='iexplore.exe' call terminate
That last one kills all processes running iexplore.exe.  If you just ran that to see what it would do without reading ahead, then chances are you are not reading this right now.

 

 

Networking Windows XP script