Equivalent of which in Windows, where is a command stored?

The which command will give the location of a command in Linux. For example-

 $ which date
 /bin/date

In Windows, we have the where command which is available from Windows 2003 onwards. For example-

C:\Users\Administrator>where cmd
C:\Windows\System32\cmd.exe

If you run it in a Powershell, use where.exe because where is an alias for Where-Object.

Advertisements

Get a list of VMs in Hyper-V

Get a list of all VMs:

Get-VM

Get-WmiObject -Namespace root\virtualization -class msvm_computersystem | select elementname, operationalstatus, processid, name| ft -auto

Windows 2012 R2:

Get-WmiObject -Namespace root\virtualization\v2 -class msvm_computersystem | select elementname, operationalstatus, processid, name| ft -auto

Get a list of all running VMs:

Get-VM | grep Running

Get-VM |  Where-Object {$_.State –eq 'Running'}

tasklist /v | grep vmwp