Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Understanding wmic

wmic is the command-line implementation of Windows Management Instrumentation (WMI). It extends WMI so that you can execute many WMI commands without a full understanding of the underlying details.

WMI is a group of technologies that allows different applications to interact with the Windows operating system. It is based on the Web-Based Enterprise Management (WBEM) standard and it’s a full-blown scripting tool. Administrators use WMI scripting to perform a wide variety of administrative tasks, and WMI scripting is included in many third-party vendor tools.

Note

Creating scripts with WMI is beyond the scope of this book. However, the scripting pros at Microsoft have an active website with a lot of rich content on WMI. Check it out here: http://technet.microsoft.com/dd742341.aspx.


Some of the most valuable commands and switches are summarized in the following table.

CommandDescription
wmic alias list brief
C:\>wmic alias list brief

Retrieves a list of all aliases.
wmic aliasname  list full
C:\>wmic computersystem  list full

Retrieves a list of all properties and known values for any alias.
wmic aliasname  get /?
C:\>wmic computersystem  get /?

Retrieves a list of properties for an alias, including the data type and available operations.
wmic aliasname  set /?
C:\>wmic computersystem  set /?

Retrieves a list of properties for an alias that can be modified. The list includes the data type and available operations.
/output:target
C:\>wmic /output:c:\data\cpu.txt
computersystem list full

Redirects the output to a file. You can redirect the output to the Clipboard by using /output:clipboard.
delete (a process)
wmic process where (name =
process-name) delete
C:\>wmic process where (name =
'notepad.exe') delete

Deletes an instance of a running process.


  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint