Created
December 15, 2013 23:38
-
-
Save janegilring/7979908 to your computer and use it in GitHub Desktop.
The Rename-ClusterResource.ps1 script will rename all cluster disks in a Failover Cluster based on the name of the underlying disk volume.
This file contains 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
$ClusterDisks = Get-CimInstance -ClassName MSCluster_Resource -Namespace root/mscluster -Filter "type = 'Physical Disk'" | |
foreach ($Disk in $ClusterDisks) { | |
$DiskResource = Get-CimAssociatedInstance -InputObject $Disk -ResultClass MSCluster_DiskPartition | |
if (-not ($DiskResource.VolumeLabel -eq $Disk.Name)) { | |
Invoke-CimMethod -InputObject $Disk -MethodName Rename -Arguments @{newName = $DiskResource.VolumeLabel} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment