Skip to content

Instantly share code, notes, and snippets.

@janegilring
Created December 15, 2013 23:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janegilring/7979908 to your computer and use it in GitHub Desktop.
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.
$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