Posted On July 23, 2020

Hyper-V: Search for Guest VMs Utilizing Certain Storage Paths

kimconnect 0 comments
blog.KimConnect.com >> Virtualization >> Hyper-V: Search for Guest VMs Utilizing Certain Storage Paths
$pathSearch='C:\ClusterShare\RandomFolder'

$pathSearch='C:\ProgramData'
$allHyperVHosts={(Get-ClusterNode | Where { $_.State –eq "Up" }).Name | %{$_.ToLower()}}.Invoke() 
$allVms=foreach ($hyperVHost in $allHyperVHosts){invoke-command -computername $hyperVHost -scriptblock{Get-VM |select Name,Path}}
$allVms|?{$_.Path -like "*$pathSearch*"}

Leave a Reply

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

Related Post

ESXi How To Perform Some Routine Tasks

Enable SSH on ESXi: Log onto vSphere Client as root Home >> Inventory >> Configuration…

Upgrade Virtual Hardware Version in VMM

The following script will upgrade all guest virtual machines from a lower version to the…

Kubernetes – Pausing Applications by Scaling Deployments or Stateful Sets

# Pause application kubectl scale deploy nextcloud --replicas=0 kubectl scale statefulsets nextcloud-db-postgresql --replicas=0 kubectl scale…