WMIC Quick Reference
WMIC Quick Reference
Version 20191223
WMIC examples
Provide a brief listing of the environment variables on the local system and stores the results, formatted
as a list, to a text file on a remote share on server1:
wmic environment list brief /format:list >
\\server1\BaselineData\Client2\environment.txt
Query a remote system called server1 to get the name, process ID, parent process ID, thread count,
handle count, and command line used to start each process. Output the results to a file called
processes.txt on the local system:
wmic /node:server1 /output:processes.txt process get name, processid,
parentprocessid, threadcount, handlecount, commandline
Display the name and executable path of any process running on the local system where “Download” is
included in the path to the associated executable:
wmic process where (ExecutablePath LIKE "%Download%") get name,
executablepath
Display the name executable path, and parent process ID of any process running on the local system
where “Windows” is not included in the path to the associated executable:
wmic process where (NOT ExecutablePath LIKE "%Windows%") get name,
executablepath, ParentProcessID
Display the IP address, MAC address, Default Gateway and DNS host name for the local system:
wmic nicconfig get MACAddress, DefaultIPGateway, IPAddress,
DNSHostName
WMIC Quick Reference
Version 20191223
Output the name, caption, state, start mode, and path to executable for services running on the remote
system server1 to a CSV file called services.csv:
wmic /node:Server1 /user:[email protected] service get Name,
Caption, State, StartMode, pathname /format:csv > services.csv
Display details of quick fix engineering patches applied to a list of systems. The list is stored one system
per line in the Systems.txt file:
wmic /node:@Systems.txt qfe get csname, description, FixComments,
HotFixID, InstalledBy, InstalledOn, ServicePackInEffect
Example of using a for loop to perform multiple queries a list of systems (in Systems.txt), outputting
the results for each system into a text file named for that system and the date in YYYMMDD format:
for /F %i in (Systems.txt) do @echo scanning %i & wmic /node:%i
/failfast:on process get name, processid, parentprocessid,
threadcount, handlecount >> %i%date:~-4,4%%date:~-7,2%%date:~-
10,2%.txt & wmic /node:%i /failfast:on environment list brief >>
%i%date:~-4,4%%date:~-7,2%%date:~-10,2%.txt & wmic /node:%i
/failfast:on nicconfig get MACAddress, DefaultIPGateway, IPAddress,
IPSubnet, DNSHostName, DNSDomain >> %i%date:~-4,4%%date:~-7,2%%date:~-
10,2%.txt & wmic /node:%i /failfast:on service get Name, Caption,
State, ServiceType, StartMode, pathname >> %i%date:~-4,4%%date:~-
7,2%%date:~-10,2%.txt & wmic /node:%i /failfast:on qfe get
description, FixComments, HotFixID, InstalledBy, InstalledOn,
ServicePackInEffect >> %i%date:~-4,4%%date:~-7,2%%date:~-10,2%.txt