Created
November 13, 2017 19:12
-
-
Save mczerniawski/65f8af157d6656552af9f3d753d5ebe0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $cluster = 'cluster' | |
| $HVNodesActive = Get-ClusterNode -Cluster $cluster | where {$_.State -eq 'UP'} | |
| $AllVMs = Get-VM -ComputerName $HVNodesActive | select Name,Path,ComputerName | |
| #MOVE VMS where Storage IS | |
| foreach ($hvhost in $HVNodesActive) { | |
| foreach ($VM in ($AllVMs | where {$_.ComputerName -ne $hvhost -AND $_.Path -match $hvhost} ).Name) { | |
| Get-ClusterGroup $VM -Cluster $cluster | Move-ClusterVirtualMachineRole -Node $hvhost -Wait 0 -ErrorAction SilentlyContinue | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment