Hi, i am a newbie to powercli and after a few sleepless nights, some coffee and lots of reading i have put together a script that deploys some sample VMs for demo purposes. But when I use the script to roll out the VMs from template, the VMs are correctly named but the DNS name is exactly the same as the template - which is expected as I am not using any customisation for each VM.
Is there a way to change the DNS name (not the VM - the VM name is correct when I look into the properties of the VM) name using command line or do I have to use a customisation setup? VM name for each VM is DemoVM and not DemoVMx
My commands are:
# Add esx host to vCenter
Add-VMHost -Name esxdemo -Location PODDemo -User root -Password xxxx -Force
# Deploy Demo VMs
Get-Template DemoVM | New-VM –Name DemoVM1 -VMHost esxdemo -Datastore datastore1_esxdemo
Get-Template DemoVM | New-VM –Name DemoVM2 -VMHost esxdemo -Datastore datastore1_esxdemo
# Remove hosts from management vCenter
Connect-VIServer -Server vCenter -Protocol https -User Administrator -Password xxxxxx
Remove-VMHost -VMHost esxdemo -Server vCenter -confirm:$false
# Connect to each ESXi host in turn and rename the local datastore.
Connect-VIServer -Server esxdemo -Protocol https -User root -Password xxxx
Get-Datastore -VMHost esxdemo -Name datastore1_esxdemo | Set-Datastore -Name datastore1
Any help would be appreciated.
Many thanks