‘wmic.exe’ is not recognized as an internal or external command, operable program or batch file

This sneppet guides you on how resolve command prompt or powershell error ‘wmic.exe’ is not recognized as an internal or external command, operable program or batch file.

‘wmic.exe’ is not recognized as an internal or external command

The WMI command-line (WMIC) utility provides a command-line interface for Windows Management Instrumentation (WMI). WMIC will work well with existing shells and utility commands.

If wmic utility is not found in your PATH, then you might get the following error.

C:\> wmic

'wmic' is not recognized as an internal or external command,
operable program or batch file.

C:\> echo %PATH%

C:\Program Files\Java\openjdk-9.0.4\bin;.;C:\Program Files\apache-maven\bin;.;C:\Program Files\WSO2\Enterprise
Integrator.4.0\bin;.;C:\Windows\System32;.;C:\Program Files\nodejs\;C:\Users\nithip\AppData\Roaming\npm

Set wmic.exe utility directory in PATH

To set WMI Command-line (WMIC) utility directory in PATH environment variable, you need to add the following entry C:\Windows\System32\wbem in the PATH.

Note, either you can add this entry via Advanced system settings link -> Environment Variables -> System Variables -> PATH environment variable from control panel in case of Windows 8 and Windows 10, via Computer icon -> Properties -> Advanced system settings -> Environment Variables -> System Variables -> PATH in case of Windows 7 to set path.

(or) 

You can set path via command line as shown below.

C:\> set path=%PATH%;C:\Windows\System32\wbem;

C:\> echo %PATH%

C:\Program Files\Java\openjdk-9.0.4\bin;.;C:\Program Files\apache-maven\bin;.;C:\Program Files\WSO2\Enterprise
Integrator.4.0\bin;.;C:\Windows\System32;.;C:\Program Files\nodejs\;C:\Users\nithip\AppData\Roaming\npm;C:\Windows\System32\wbem;

C:\> wmic
wmic:root\cli >

Using WMIC.exe help utility

Windows Management Instrumentation (WMI) is the Microsoft implementation of Web-Based Enterprise Management (WBEM), which is an industry initiative to develop a standard technology for accessing management information in an enterprise environment.

WMI uses the Common Information Model (CIM) industry standard to represent systems, applications, networks, devices, and other managed components.

WMIC includes online help at the command line. First, at the command prompt type wmic to start the WMIC shell and then type /? at any level to display list of alias and syntax.

C:\> wmic

wmic:root\cli>/?

[global switches] <command>

The following global switches are available:
/NAMESPACE           Path for the namespace the alias operate against.
/ROLE                Path for the role containing the alias definitions.
/NODE                Servers the alias will operate against.
/IMPLEVEL            Client impersonation level.
/AUTHLEVEL           Client authentication level.
/LOCALE              Language id the client should use.
/PRIVILEGES          Enable or disable all privileges.
/TRACE               Outputs debugging information to stderr.
/RECORD              Logs all input commands and output.
/INTERACTIVE         Sets or resets the interactive mode.
/FAILFAST            Sets or resets the FailFast mode.
/USER                User to be used during the session.
/PASSWORD            Password to be used for session login.
/OUTPUT              Specifies the mode for output redirection.
/APPEND              Specifies the mode for output redirection.
/AGGREGATE           Sets or resets aggregate mode.
/AUTHORITY           Specifies the <authority type> for the connection.
/?[:<BRIEF|FULL>]    Usage information.

For more information on a specific global switch, type: switch-name /?


The following alias/es are available in the current role:
ALIAS                    - Access to the aliases available on the local system
BASEBOARD                - Base board (also known as a motherboard or system board) management.
BIOS                     - Basic input/output services (BIOS) management.
BOOTCONFIG               - Boot configuration management.
CDROM                    - CD-ROM management.
COMPUTERSYSTEM           - Computer system management.
CPU                      - CPU management.
CSPRODUCT                - Computer system product information from SMBIOS.
DATAFILE                 - DataFile Management.
DCOMAPP                  - DCOM Application management.
DESKTOP                  - User's Desktop management.
DESKTOPMONITOR           - Desktop Monitor management.
DEVICEMEMORYADDRESS      - Device memory addresses management.
DISKDRIVE                - Physical disk drive management.
DISKQUOTA                - Disk space usage for NTFS volumes.
DMACHANNEL               - Direct memory access (DMA) channel management.
ENVIRONMENT              - System environment settings management.
FSDIR                    - Filesystem directory entry management.
GROUP                    - Group account management.
IDECONTROLLER            - IDE Controller management.
IRQ                      - Interrupt request line (IRQ) management.
JOB                      - Provides  access to the jobs scheduled using the schedule service.
LOADORDER                - Management of system services that define execution dependencies.
LOGICALDISK              - Local storage device management.
LOGON                    - LOGON Sessions.
MEMCACHE                 - Cache memory management.
MEMORYCHIP               - Memory chip information.
MEMPHYSICAL              - Computer system's physical memory management.
NETCLIENT                - Network Client management.
NETLOGIN                 - Network login information (of a particular user) management.
NETPROTOCOL              - Protocols (and their network characteristics) management.
NETUSE                   - Active network connection management.
NIC                      - Network Interface Controller (NIC) management.
NICCONFIG                - Network adapter management.

Further, to display options available for specific alias let’s say process, you need type the following from WMIC CLI.

wmic:root\cli>process/?

PROCESS - Process management.

HINT: BNF for Alias usage.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>].

USAGE:

PROCESS ASSOC [<format specifier>]
PROCESS CALL <method name> [<actual param list>]
PROCESS CREATE <assign list>
PROCESS DELETE
PROCESS GET [<property list>] [<get switches>]
PROCESS LIST [<list format>] [<list switches>]

Also See:

References:

Leave a Reply

avatar
  Subscribe  
Notify of