Hello community friends!
I am trying to work a process into a migration project that I am working on. Basically I am migrating some VMs from on-prem vCenter to Azure and once they are migrated I need to append “_AzureMigrated” to the VM's display name in vCenter. I found this script but thought I should run it by the community.
# Connect to vCenter Server
Connect-VIServer -Server vCenterServer
# Get the virtual machine object
$vm = Get-VM -Name "VMName"
# Append "_AzureMigrated" to the display name
$vm.ExtensionData.Config.Name += "_AzureMigrated"
# Update the virtual machine
$vm | Set-VM
# Disconnect from vCenter Server
Disconnect-VIServer -Confirm:$false
Afaik that is not how a rename of the Display name works.
Try something like this
$vmName = 'VMName'
# Connect to vCenter Server
Connect-VIServer -Server vCenterServer
# CHange the VM's Display name
Get-VM -Name $vmName | Set-VM -Name "$vmName_AzureMigrated" -COnfirm:$false
# Disconnect from vCenter Server
Disconnect-VIServer -Confirm:$false
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Afaik that is not how a rename of the Display name works.
Try something like this
$vmName = 'VMName'
# Connect to vCenter Server
Connect-VIServer -Server vCenterServer
# CHange the VM's Display name
Get-VM -Name $vmName | Set-VM -Name "$vmName_AzureMigrated" -COnfirm:$false
# Disconnect from vCenter Server
Disconnect-VIServer -Confirm:$false
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks @LucD can always count on you 🙂