Skip to content

Instantly share code, notes, and snippets.

@janegilring
Created December 15, 2013 23:38
Show Gist options
  • Select an option

  • Save janegilring/7979908 to your computer and use it in GitHub Desktop.

Select an option

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}
}
}
@sayyedaleem
Copy link

Splendid Share!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment