Share via


Rename the Cluster Network Names and Disk Names using PowerShell

Hey Folks,

Installed Microsoft Clusters and Hyper V Clusters many times using PowerShell but it has always been a manual element to change the **cluster Network names ** and  Cluster Disk Names.
Here is the script.

##############################################################            
#### Which Cluster network    ?         
$subnet = Read-Host "Enter the first three octets of your Subnet"             
$newname = Read-Host "Enter the desired network name"            
              
              
#### String concatenation to add a wildcard             
$subnet = $subnet + ".*"            
####### Below with get the network name #####################            
$oldname = Get-ClusterNetwork  | ?{$_.Address -like $subnet }| Select-Object name | ForEach-Object {$_.name}             
########## This will set the new name .. please note this is one of those hidden power of powershell changing the name #without set cmdlet            
(Get-ClusterNetwork -Name $oldname).Name = $newname

To rename the Cluster Shared Volume Disk below is the script. This script assumes your old Cluster disk name has default Microsoft naming convention. For example, like Cluster Disk followed by number.

##############################################################            
#### Which Cluster disk ? User input             
$disknumber = Read-host "Enter the disk number you want to change the name "            
$newname = Read-host "enter the new name of your disk"             
##### This script assumes your disk names are out of the box disk names ie.c Cluster Disk followed by number so we are doing #string concatenation here            
$disknumber = "Cluster Disk "+ $disknumber            
#### Below line is a new feature changing the value without set cmdlet             
(Get-ClusterSharedVolume -Name $disknumber).Name = $newname

To rename the Cluster Disk Below is the script. This script assumes your old Cluster disk name has default Microsoft naming convention. For example, like Cluster Disk followed by number.

##############################################################            
#### Which Cluster disk ? User input             
$disknumber = Read-host "Enter the disk number you want to change the name "            
$newname = Read-host "enter the new name of your disk"             
##### This script assumes your disk names are out of the box disk names ie.c Cluster Disk followed by number so we are doing #string concatenation here            
$disknumber = "Cluster Disk "+ $disknumber            
#### Below line is a new feature changing the value without set cmdlet             
(Get-ClusterResource -Name $disknumber).Name = $newname