wmic vs WMI Powershell cmdlets
Compare WMIC.EXE with Windows Powershell Cmdlets for WMI
The WMI command-line (WMIC) utility provides a command-line interface for WMI. With Windows 7 you can do everything that you can do with wmic using Windows Powershell and much more by leveraging powerful features of Windows Powershell.
Below are some scenarios in wmic and their equivalent in Windows Powershell commands, try them out and compare the results and general experience working with both -
WMIC Version |
Windows Powershell Version |
wmic bios get caption, manufacturer, smbiosbiosversion, version |
get-wmiobject win32_bios caption, manufacturer, smbiosbiosversion, version |
wmic logicaldisk where drivetype=3 get name, freespace, systemname, filesystem, size, volumeserialnumber /format:list |
get-wmiobject win32_logicaldisk name, freespace, systemname, filesystem, size, volumeserialnu mber -filter drivetype=3 |
wmic process call create 'notepad.exe' |
invoke-wmimethod win32_process -name create -argumentlist 'notepad.exe' |
wmic /node:<machine name> /user:<username>/password:<password> logicaldisk where drivetype=3 get name, freespace, filesystem, size |
Get-wmiobject -ComputerName <machine name> -credential <remote credentials> win32_logicaldisk name, freespace, systemname, filesystem, size, volumeserialnumber -filter drivetype=3 |
WMIC PROCESS where name='notepad.exe' delete |
gwmi win32_process -filter "name='notepad.exe'" | remove-wmiobject |
wmic ENVIRONMENT SET NAME="TEMP", VARIABLEVALUE="NEW" , username="<system>" |
gwmi win32_environment -filter 'Name="testvar" and username="<system>"' | set-wmiinstance -argument @{variableValue="testvalue"} |
Kapil Mathur [MSFT]