Rename VMs in cluster to match SCVMM naming
Another one from the vaults:
If you’ve been using Hyper-V clusters with SCVMM, you’ll probably notice the cluster resources named a specific way when the VM role is made highly available with SCVMM.
example shown below:
Â
Now if you’re a bit of a nutter like me, and can’t stand the cluster roles that don’t have the “SCVMM
Note, I do not do this often, as when I find VM roles with a non-SCVMM naming convention, this lets me know there is a process issue and engineers are creating HA VMs outside of SCVMM.
Be mindful that this changes the name of your cluster role so if you have anything depending on this you should check before applying
Below is the script I ran to change the names… You’ll need to remove the hash on line 8 to actually make the change.
$clusters = Get-SCVMHostCluster | select Name
ForEach($cluster in $clusters){
    $vms = Get-ClusterGroup -Cluster $cluster.name | where {
$_.Name -notlike "*Cluster Group*" -and $_.Name -notlike "*Available Storage*" -and $_.Name -notlike "SCVMM *"
} | ogv -PassThru
    ForEach($vm in $vms){
        $newname = "SCVMM " + $vm.Name + " Resources"
        Write-Host -ForegroundColor Yellow "Old name $($vm.name) and new name will be $($newname)"
        #$vm.Name = $newname
    }
}
Anyway, as always, use with caution.
Cheers Dan
s