WMI examples

1. To get disk info:
wmic.exe diskdrive get model,name,size
or for remote host: wmic.exe /node:computername diskdrive get model,name,size

wmic.exe logicaldisk where drivetype=3 get name, freespace, systemname, filesystem, size, volumeserialnumber
wmic.exe /node:hostname logicaldisk where drivetype=3 get name, freespace, systemname, filesystem, size, volumeserialnumber

2. To get process list:

wmic.exe process get name,processid
wmic.exe /node:computername get name, processid

wmic.exe process list brief
wmic.exe /node:hostname process list brief

TASKLIST can also be used: tasklist.exe /S REMOTEHOST /U username /P password

3. To kill process:

wmic.exe process where processid=”1000″ call terminate
wmic.exe /node:hostname process where processid=”1000″ call terminate

wmic.exe process where name=”paint.exe” call terminate
wmic.exe /node:hostname process where name=”paint.exe” call terminate

TASKILL can also be used: taskkill.exe /S REMOTEHOSTNAME /U username /P password /IM notepad.exe

4. Printer list status:

wmic.exe printer list status
wmic.exe /node:hostname printer list status

5. Get BIOS info:

wmic.exe /Output:bios.html BIOS Get Manufacturer,Name,Version /Format:htable
wmic.exe /node:hostname /Output:bios.html BIOS Get Manufacturer,Name,Version /Format:htable

6. Start an application:

wmic.exe process call create “notepad.exe”
wmic.exe /node:hostname call create “notepad.exe”

7. OS information report:

wmic.exe os get bootdevice, buildnumber, caption, freespaceinpagingfiles, installdate, name, systemdrive, windowsdirectory /format:htable > c:\osinfo.htm
wmic.exe /node:hostname os get bootdevice, buildnumber, caption, freespaceinpagingfiles, installdate, name, systemdrive, windowsdirectory /format:htable > c:\osinfo.htm

8. Disk space check:

wmic.exe logicaldisk get FreeSpace
wmic.exe /node:hostname logicaldisk get FreeSpace

9. Who is logged in to remote PC

wmic.exe /node:(computername or ip address) computersystem get username

10. SERVICES list status and restart

wmic.exe service list brief
wmic.exe /node:remotehost service list brief

11. ADD REMOVE PROGRAMS PRODUCTS Listing

wmic.exe product list brief
wmic.exe /node:hostname product list brief
wmic.exe product get name – displays all product names from Add Remove Programs

12. WMI UNINSTALL command.

wmic.exe product get name
wmic.exe product where name=”product name here” call uninstall

wmic.exe /node:hostname product get name
wmic.exe /node:hostname product where name=”product name here” call uninstall

To make it default YES for uninstall, add /nointeractive or /interactive:off

Uninstall program with the specific word:

wmic product where name like ‘%Office%’ call uninstall /nointeractive
wmic product where “name like ‘%Vantrex%’” call uninstall /nointeractive

13. Check OS Systemtype

wmic.exe computersystem get systemtype
wmic.exe /node:hostname computersystem get systemtype

14. GET COMPUTER MODEL

wmic.exe computersystem get model
wmic.exe /node:hostname computersystem get model

15. GET COMPUTER MANUFACTURER

wmic.exe computersystem get manufacturer
wmic.exe /node:hostname computersystem get manufacturer

MORE … computersystem get /?

16. GET OS INFO or SYSTEMTYPE

wmic computersystem get “Model”,”Manufacturer”,”Name”,”UserName”

wmic.exe os get name
wmic.exe /node:hostname os get name

17. Get list of installed updates with dates:

wmic.exe qfe get description,installedOn
wmic.exe /node:hostname get description, installedOn

wmic qfe get Hotfixid

wmic qfe

wmic qfe | find “938194”

18. ENABLE RDP

wmic /node:”computername” /user: “domainname\username” /password:”password”
rdtoggle where servername=”computername” call SetAllowTSConnections

Run WMI querues accross network:

wmic /node:@nodes.txt /user:administrator /password:mypassword /output:out.csv bios get serialnumber /format:csv

19. CPU GET NAME

wmic.exe cpu get name
wmic.exe /node:hostname cpu get name

20. PRINTERCONFIG – displays all printer info

wmic.exe printerconfig
wmic.exe /node:hostname printerconfig

21. SHARE – displays all shared resources

wmic.exe share
wmic.exe /node:hostname share

22. USERACCOUNT – gets all user info

useraccount list full , or useraccount where name=”user” list full

23 STARTUP Check

wmic startup get caption,command

24. IDENTIFY GRAPHICS CARD

wmic PATH Win32_videocontroller GET description – current installed type.

wmic PATH Win32_videocontroller GET pnpdeviceid – gets hardware ID

Momi.rt@gmail.com

momi.rt@gmail.com

Leave a Reply

Your email address will not be published. Required fields are marked *