Hi,
I would like to set the capacity of the "C:\" drive dynamically when cloning.
Some of my guests need 60GB drives and others need as much as 200GB. The preference would be to use the same template for either. Both 8.1 and 2012r2 supposedly have hooks to make this easier.
Is this possible to script, or am I chasing butterflies?
-T
From the name of that VM I guess it is running W2K12R2 ?
I'm afraid the cmdlets that are based upon or use the Invoke-VMSCript concept, do not yet support Windows 2012 R2 afaik.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Afaik the clone version of the New-VM cdlet doesn't allow you to specify the DiskGB or DiskMB parameters.
Those parameters are only available in the DefaultParameterset, not in the CloneVM parameterset.
It might be possible with the CloneVM_Task method, but I haven't tried that yet I must admit.
I'll give it a shot.
As an alternative you might make it a 2-step process, first do the cloning, then change the size of the system disk.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
As an alternative you might make it a 2-step process, first do the cloning, then change the size of the system disk.
Is that possible to do with a script? I
It might be possible with the CloneVM_Task method, but I haven't tried that yet I must admit.
I'll give it a shot.
...and thanks, Luc.
-T
I tried this and got the error below:
> get-harddisk -vm taw2k12r2t000 | where { $_.Name -eq "Hard disk 1" } | set-harddisk -capacitygb 100 -ResizeGuestPartit
ion -confirm:$false
set-harddisk : 11/15/2013 8:27:09 Set-HardDisk Execution of the script in guest OS on VM 'taw2k12r2t000'
failed: 'Specified disk "SAS:0:0" was not found
'
At line:1 char:72
+ get-harddisk -vm taw2k12r2t000 | where { $_.Name -eq "Hard disk 1" } | set-hardd ...
+ ~~~~~~~~~
+ CategoryInfo : InvalidData: (taw2k12r2t000:VirtualMachineImpl) [Set-HardDisk], VimException
+ FullyQualifiedErrorId : Client20_RunScriptInGuestHelper_RunScriptFileInGuest_ScriptError,VMware.VimAutomation.Vi
Core.Cmdlets.Commands.VirtualDevice.SetHardDisk
WARNING: Specified disk "SAS:0:0" was not found
CapacityGB Persistence Filename
---------- ----------- --------
100.000 Persistent [TCStore] taw2k12r2t000/taw2k12r2t000.vmdk
From the name of that VM I guess it is running W2K12R2 ?
I'm afraid the cmdlets that are based upon or use the Invoke-VMSCript concept, do not yet support Windows 2012 R2 afaik.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yup. Correct. At least I know why it isn't working.
I'm using vCO to deploy servers running post task scripts to customise the O/S via invoke-vmscript.
Is there any news when it will be supported? This is devastating.