WMIC - Windows Management
WMIC - Windows Management
Search
WMIC.exe
Windows Management Instrumentation Command.
Read a huge range of information about local or remote computers. Also provides a way to make
configuration changes to multiple remote machines.
Syntax
Retrieve information about <Alias>:
WMIC [global_switches] [/locale:ms_409] <alias> [options] [format]
Interactive mode:
WMIC
Aliases:
ALIAS - Access local system aliases [CALL]
CDROM - CD-ROM
COMPUTERSYSTEM - Computer system [CALL/SET]
CPU - CPU
CSPRODUCT - Computer system product information from SMBIOS.
Options
By default an alias will return a standard LIST of information, you can also choose to GET one or more
specific properties.
Configuration changes can be made, where indicated above with: [CALL or SET ]
The CREATE and DELETE options allow you to change the WMI schema itself.
alias
alias LIST [BRIEF | FULL | INSTANCE | STATUS |SYSTEM | WRITEABLE]
[/TRANSLATE:BasicXml|NoComma ]
[/EVERY:no_secs] [/FORMAT:format]
alias GET [property list]
[/VALUE ] [/ALL ] [/TRANSLATE:BasicXml|NoComma ]
[/EVERY:no_secs] [/FORMAT:format]
alias CALL method_name [parameters]
alias SET [assignments]
alias CREATE
alias DELETE
alias ASSOC [/RESULTCLASS:classname] [/RESULTROLE:rolename][/
ASSOCCLASS:assocclass]
The order of the /FORMAT and /TRANSLATE switches is significant: if /TRANSLATE follows /FORMAT, the
output is formatted first and then translated.
All the options above can be extended with a WHERE clause, best shown by the examples below:
Format:
Format defines the layout of the information, XML output is automatically formatted using a default style
sheet, while other formats (HTML, Table, MOF, Raw XML etc) can be specified using /FORMAT:
stylesheet_name
The PROCESS alias can be used to start a new installation process, if doing this across the network, place
the installer files on a share with permissions EVERYONE : Read Only. This is because network credentials
will be dropped when jumping from one remote machine to another (unless you have kerberos configured).
Examples
WMIC /locale:ms_409 OS
WMIC SERVICE where (state=”running”) GET caption, name, state > services.tsv
Interactive mode:
C:>START "Windows Management" WMIC
wmic:root\cli>/locale:ms_409
wmic:root\cli> OS get csname
wmic:root\cli>quit
Notes
The availability of WMI information does vary across different versions of Windows
e.g. ODBC, SNMP, Windows Installer.
In Windows 2000, around 4,000 properties can be monitored, and around 40 can be configured.
In Windows XP around 6,000 properties can be monitored, and around 140 can be configured.
subsequent times you run WMIC, it will start immediately. Under XP WMIC is slower to initialise, therefore to
run several WMI queries it can be quicker to use interactive mode.
* WMI information for installed software packages (PACKAGE and SOFTWAREFEATURE) is often
incomplete and inconsistent for a variety of historical reasons. A more reliable method is to retrieve a list of
installed programs directly from the Add/Remove list in the registry, with a WSH script like this from Torgeir
Bakken.
“Life is like a game of cards. The hand you are dealt is determinism; the way you play it is free will” -
Jawaharial Nehru
Related: