hi all,
I tryed to rename a VM (the host name of the VM) via PowerCLI with this code:
New-VM -Name $name -Template $template -VMHost $vmhost
Set-VM -VM $name -OSCustomizationSpec &Spec1 -Confirm:$false
When Spec1 let the NetBIOS Name be the virtual machine name (=$name)
But, it still get the name of the template machine name (=$template),
thank's
Discussion moved from VMware vCenter™ Server to VMware vSphere™ PowerCLI
I try to do it via PowerCLI but it do nothing.
I dont know why.
do you think that I need to wait couple of minutes before it supposed to work?
I don't think that you have to wait. You can specify the new name using the Set-VM -Name parameter: The following works for me:
PowerCLI C:\Users\Robert> $VM = Get-VM -Name test1
PowerCLI C:\Users\Robert> $VM
Name PowerState Num CPUs MemoryGB
---- ---------- -------- --------
test1 PoweredOff 1 0,250
PowerCLI C:\Users\Robert> Set-VM -VM $VM -Name test2 -Confirm:$false
Name PowerState Num CPUs MemoryGB
---- ---------- -------- --------
test2 PoweredOff 1 0,250
this will change the name of the VM in vCenter GUI but, I want to rename the name of the machine inside the VM
for some reasons it's take more than 15 min. and in other case it's even more.
why is that?
every time when I deploy VM and rename it, it take unexpected time(between 15 min. and 2 hours), why?
When you rename the hostname in the guest OS by using the OSCustomizationSpec, you run the complete sysprep sequence.
That takes some time.
In the logs that are mentioned, you should find timestamps for the actions that are taken.
From there you should be able to determine which action(s) are the big time consumers.
Can you find anything conclusive in the logs ?
If possible, attach one of those logs.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
it's just wrote what I mentioned last Reply:
And I was referring to the log in that message (C:\Windows\TEMP\vmware-imc\guestcustlog)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Why don't you try to use the Invoke-VMScript cmdlet and execute the following inside the guest OS.
$obj = Get-WmiObject Win32_ComputerSystem
$obj.Rename("NewName")
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
there is sometimes that the VM stop after the row : "The network interfaces are connected on 1 second"
and didn't continue to the next step.
you know why?
The failure reconfigured stop before the row "Successfully opened key SOFTWARE\VMware, Inc.\Guest Customization\"
No clue I'm afraid
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
hi,
I found that every time that I tried to customize the VM twice, the second time failed,
did you know why?
Did you restart the guest OS after the 1st name change ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
yes sure, you can't customize again without it... :smileyplain:
So you are doing the rename with the OSCustomizationSpec ?
If yes, you might have hit the problem described in KB929828
What failure do you get ? Any error messages ? Anything in the log ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
1. I deploy a VM via PowerCLI
2. I run OSCustomizationSpec via PowerCLI and it's really change the name inside the VM
3. I turn off the VM.
4. I run this line: "Set-VM -VM VMOldName -Name VMNewName -OSCustomizationSpec Spec1" that change the name of the VM (not inside) and after it run the OSCustomizationSpec again.
5. the neme is not change never because the customization is not finished never, it stack when the last rows in the log file is :
Got VMX response 'connected'
The network interfaces are connected on 1 second
the next rows (that didn't appear but i know that from the first customization) is:
Successfully opened key SOFTWARE\VMware, Inc.\Guest Customization\
Size of reg_multi_sz 21.
thanks again.