WHAT IS WMIC ? USEFUL WMIC COMMAND EXAMPLES IN WINDOWS ( PART 2 )
The Windows Management Instrumentation Command line (WMIC) is a software utility that allows users to performs Windows Management Instrumentation (WMI) operations with a command prompt.
WMIC operates in two modes, interactive (which allows commands to be entered one line at a time) and non-interactive (which allows commands to be scripted for use in batch files). The simplest way to launch WMIC is to open a Run dialog and type wmic. Windows users can review a complete listing of aliases and global switches by typing /? at the wmic prompt.
In this example I will take you through useful wmic command examples in Windows. Check all the options available with wmic command. If you want to check all the option available with wmic command then you need to use wmic /? command as shown below.
Syntax
wmic [global switches] <command>
Global switches
| /NAMESPACE | NAMESPACE – Path for the namespace the alias is to operate against. Namespaces are always relative. That is, if the namespace does not begin with a “\\” it is assumed to be relative to the current namespace.
USAGE: /NAMESPACE:<namespace> |
| /ROLE | ROLE – Path for the role containing the alias definitions to be available for the utility session.
USAGE: /ROLE:<namespace> |
| /NODE | NODE – Specify what servers the alias will operate against.
USAGE: /NODE:<machine id list> NOTE: Enclose the switch value in double quotes, if the value contains special characters like ‘-‘ or ‘/’. |
| /IMPLEVEL | IMPLEVEL – Determine what level the command line should impersonate. Default is ‘Impersonate’.
USAGE: /IMPLEVEL:<implevel>[/AUTHORITY:<authority type>] Various implevels are as follows: Note: Use /AUTHORITY switch for specifying the authority type. |
| /AUTHLEVEL | AUTHLEVEL – Specify the level the command line should authenticate. Default is ‘Pktprivacy’.
USAGE: /AUTHLEVEL:<authlevel> Various authlevels are as follows: |
| /LOCALE | LOCALE – Specify the language id the command line should use.
USAGE: /LOCALE:<locale identifier> |
| /PRIVILEGES | PRIVILEGES – Enable or disable all privileges.
USAGE: /PRIVILEGES:<option> |
| /TRACE | TRACE – Specify whether output debug information is to be copied to stderr during the processing of the request(s).
USAGE: /TRACE:<option> |
| /RECORD | RECORD – Logs all entered commands and WMIC’s output to a file in XML format.
USAGE: /RECORD:<filepath> |
| /INTERACTIVE | INTERACTIVE – Sets or resets the interactive mode.
USAGE: /INTERACTIVE:<option> |
| /FAILFAST | FAILFAST – Sets or resets the FailFast mode.
USAGE: /FAILFAST:<option> |
| /USER | USER – Provides the user to be used during the session.
USAGE: /USER:<userid> |
| /PASSWORD | PASSWORD – Provides the password to be used in logging on to this session.
USAGE: /PASSWORD:<password> |
| /OUTPUT | OUTPUT – Specifies the mode for output redirection.
USAGE: /OUTPUT:<outputspec> |
| /APPEND | APPEND – Specifies the mode for output redirection.
USAGE: /APPEND:<outputspec> |
| /AGGREGATE | AGGREGATE – Determines the mode of displaying results.
USAGE: /AGGREGATE:<option>. |
| /AUTHORITY | AUTHORITY – Specifies the <authority type> for the connection.
USAGE: /AUTHORITY:<authority type> |
| /? | /? – Displays specification/syntax for help commands.
USAGE: /?:[<helpType>] |
Enclose the switch value in double quotes, if the value contains special characters like ‘-‘ or ‘/’.
The following alias/es are available in the current role:
| ALIAS | Access to the aliases available on the local system.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: ALIAS ASSOC [<format specifier>] |
| BASEBOARD | Base board (also known as a motherboard or system board) management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: BASEBOARD ASSOC [<format specifier>] |
| BIOS | Basic input/output services (BIOS) management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: BIOS ASSOC [<format specifier>] |
| BOOTCONFIG | Boot configuration management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: BOOTCONFIG ASSOC [<format specifier>] |
| CDROM | CD-ROM management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: CDROM ASSOC [<format specifier>] |
| COMPUTERSYSTEM | Computer system management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: COMPUTERSYSTEM ASSOC [<format specifier>] |
| CPU | CPU management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: CPU ASSOC [<format specifier>] |
| CSProduct | Computer system product information from SMBIOS.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: CSProduct ASSOC [<format specifier>] |
| DATAFILE | DataFile Management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: DATAFILE ASSOC [<format specifier>] |
| DCOMAPP | DCOM Application management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: DCOMAPP ASSOC [<format specifier>] |
| DESKTOP | User’s Desktop management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: DESKTOP ASSOC [<format specifier>] |
| DESKTOPMONITOR | Desktop Monitor management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: DESKTOPMONITOR ASSOC [<format specifier>] |
| DEVICEMEMORYADDRESS | Device memory addresses management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: DEVICEMEMORYADDRESS ASSOC [<format specifier>] |
| DISKDRIVE | Physical disk drive management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: DISKDRIVE ASSOC [<format specifier>] |
| DISKQUOTA | Disk space usage for NTFS volumes.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: DISKQUOTA ASSOC [<format specifier>] |
| DMACHANNEL | Direct memory access (DMA) channel management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: DMACHANNEL ASSOC [<format specifier>] |
| ENVIRONMENT | System environment settings management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: ENVIRONMENT ASSOC [<format specifier>] |
| FSDIR | Filesystem directory entry management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: FSDIR ASSOC [<format specifier>] |
| GROUP | Group account management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: GROUP ASSOC [<format specifier>] |
| IDECONTROLLER | IDE Controller management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: IDECONTROLLER ASSOC [<format specifier>] |
| IRQ | Interrupt request line (IRQ) management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: IRQ ASSOC [<format specifier>] |
| JOB | Provides access to the jobs scheduled using the schedule service.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: JOB ASSOC [<format specifier>] |
| LOADORDER | Management of system services that define execution dependencies.
LOADORDER – Management of system services that define execution dependencies. (<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: LOADORDER ASSOC [<format specifier>] |
| LOGICALDISK | Local storage device management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: LOGICALDISK ASSOC [<format specifier>] |
| LOGON | LOGON Sessions.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: LOGON ASSOC [<format specifier>] |
| MEMCACHE | Cache memory management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: MEMCACHE ASSOC [<format specifier>] |
| MEMORYCHIP | Memory chip information.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: MEMORYCHIP ASSOC [<format specifier>] |
| MEMPHYSICAL | Computer system’s physical memory management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: MEMPHYSICAL ASSOC [<format specifier>] |
| NETCLIENT | Network Client management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: NETCLIENT ASSOC [<format specifier>] |
| NETLOGIN | Network login information (of a particular user) management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: NETLOGIN ASSOC [<format specifier>] |
| NETPROTOCOL | Protocols (and their network characteristics) management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: NETPROTOCOL ASSOC [<format specifier>] |
| NETUSE | Active network connection management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: NETUSE ASSOC [<format specifier>] |
| NIC | Network Interface Controller (NIC) management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: NIC ASSOC [<format specifier>] |
| NICCONFIG | Network adapter management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: NICCONFIG ASSOC [<format specifier>] |
| NTDOMAIN | NT Domain management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: NTDOMAIN ASSOC [<format specifier>] |
| NTEVENT | Entries in the NT Event Log.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: NTEVENT ASSOC [<format specifier>] |
| NTEVENTLOG | NT eventlog file management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: NTEVENTLOG ASSOC [<format specifier>] |
| ONBOARDDEVICE | Management of common adapter devices built into the motherboard (system board).
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: ONBOARDDEVICE ASSOC [<format specifier>] |
| OS | Installed Operating System/s management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: OS ASSOC [<format specifier>] |
| PAGEFILE | Virtual memory file swapping management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: PAGEFILE ASSOC [<format specifier>] |
| PAGEFILESET | Page file settings management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: PAGEFILESET ASSOC [<format specifier>] |
| PARTITION | Management of partitioned areas of a physical disk.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: PARTITION ASSOC [<format specifier>] |
| PORT | I/O port management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: PORT ASSOC [<format specifier>] |
| PORTCONNECTOR | Physical connection ports management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: PORTCONNECTOR ASSOC [<format specifier>] |
| PRINTER | Printer device management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: PRINTER ASSOC [<format specifier>] |
| PRINTERCONFIG | Printer device configuration management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: PRINTERCONFIG ASSOC [<format specifier>] |
| PRINTJOB | Print job management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: PRINTJOB ASSOC [<format specifier>] |
| PROCESS | Process management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: PROCESS ASSOC [<format specifier>] |
| PRODUCT | Installation package task management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: Product ASSOC [<format specifier>] |
| QFE | Quick Fix Engineering.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: QFE ASSOC [<format specifier>] |
| QUOTASETTING | Setting information for disk quotas on a volume.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: QUOTASETTING ASSOC [<format specifier>] |
| RDACCOUNT | Remote Desktop connection permission management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: RDACCOUNT ASSOC [<format specifier>] |
| RDNIC | Remote Desktop connection management on a specific network adapter.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: RDNIC ASSOC [<format specifier>] |
| RDPERMISSIONS | Permissions to a specific Remote Desktop connection.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: RDPERMISSIONS ASSOC [<format specifier>] |
| RDTOGGLE | Turning Remote Desktop listener on or off remotely.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: RDTOGGLE ASSOC [<format specifier>] |
| RECOVEROS | Information gathered from memory when the operating system fails.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: RECOVEROS ASSOC [<format specifier>] |
| REGISTRY | Computer system Registry management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: REGISTRY ASSOC [<format specifier>] |
| SCSICONTROLLER | SCSI Controller management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: SCSICONTROLLER ASSOC [<format specifier>] |
| SERVER | Server information management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: SERVER ASSOC [<format specifier>] |
| SERVICE | Service application management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: SERVICE ASSOC [<format specifier>] |
| SHADOWCOPY | Shadow copy management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: SHADOWCOPY ASSOC [<format specifier>] |
| SHADOWSTORAGE | Shadow copy storage area management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: SHADOWSTORAGE ASSOC [<format specifier>] |
| SHARE | Shared resource management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: SHARE ASSOC [<format specifier>] |
| SOFTWAREELEMENT | Management of the elements of a software product installed on a system.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: SOFTWAREELEMENT ASSOC [<format specifier>] |
| SOFTWAREFEATURE | Management of software product subsets of SoftwareElement.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: SOFTWAREFEATURE ASSOC [<format specifier>] |
| SOUNDDEV | Sound Device management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: SOUNDDEV ASSOC [<format specifier>] |
| STARTUP | Management of commands that run automatically when users log onto the computer system.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: STARTUP ASSOC [<format specifier>] |
| SYSACCOUNT | System account management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: SYSACCOUNT ASSOC [<format specifier>] |
| SYSDRIVER | Management of the system driver for a base service.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: SYSDRIVER ASSOC [<format specifier>] |
| SYSTEMENCLOSURE | Physical system enclosure management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: SYSTEMENCLOSURE ASSOC [<format specifier>] |
| SYSTEMSLOT | Management of physical connection points including ports, slots, and peripherals, and proprietary connections points.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: SYSTEMSLOT ASSOC [<format specifier>] |
| TAPEDRIVE | Tape drive management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: TAPEDRIVE ASSOC [<format specifier>] |
| TEMPERATURE | Data management of a temperature sensor (electronic thermometer).
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: TEMPERATURE ASSOC [<format specifier>] |
| TIMEZONE | Time zone data management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: TIMEZONE ASSOC [<format specifier>] |
| UPS | Uninterruptible power supply (UPS) management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: UPS ASSOC [<format specifier>] |
| USERACCOUNT | User account management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: USERACCOUNT ASSOC [<format specifier>] |
| VOLTAGE | Voltage sensor (electronic voltmeter) data management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: VOLTAGE ASSOC [<format specifier>] |
| VOLUME | Local storage volume management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: VOLUME ASSOC [<format specifier>] |
| VOLUMEQUOTASETTING | Associates the disk quota setting with a specific disk volume.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: VOLUMEQUOTASETTING ASSOC [<format specifier>] |
| VOLUMEUSERQUOTA | Per user storage volume quota management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: VOLUMEUSERQUOTA ASSOC [<format specifier>] |
| WMISET | WMI service operational parameters management.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>]. USAGE: WMISET ASSOC [<format specifier>] |
For more information on a specific alias, type: alias /? at the command prompt.
| CLASS | Escapes to full WMI schema.
USAGE: CLASS <class path expr> [<standardverb> [<verb switches>]] |
| PATH | Escapes to full WMI object paths.
USAGE: PATH (<path expr> | (<class path expr> [WHERE <where clause>])) [<verb clause>] |
| CONTEXT | Displays the state of all the global switches. |
| QUIT/EXIT | Exits the program. |
For more information on CLASS/PATH/CONTEXT, type: (CLASS | PATH | CONTEXT) /? at the prompt.
Examples
Running wmic alone takes you to the wmic:root\cli> prompt. At the prompt, type /? to get help at any time or <alias> /? to get additional help with that alias. To quit from the wmic prompt, type quit or exit.
wmic logicaldisk get name
Display each of the logical disk drives on the computer, as shown below. If you wanted to see all the options for this command, including name, type:Â wmic logicaldisk get /?
Name C: D: E:




