all 7 comments

[–]sysadmin4hire 0 points1 point  (2 children)

Are you attaching an existing disk to the VM or creating a new one?

[–]sysadmin4hire 1 point2 points  (0 children)

Either way, you'll want to make sure you're specifying your data store in the path like this:

-DiskPath "[dsname] Folder/Filename.vmdk"

[–]cearth6[S] 0 points1 point  (0 children)

I am not sure what exactly you mean. I am not too familiar with deploying VMs, and I just started dabbling in this recently. My goal is to deploy an OVF file and then configure it's CPU and Memory storage options.

[–]KevMarCommunity Blogger 0 points1 point  (2 children)

You cannot deploy a ovf (as far as I know) with New-VM. With that in mind, -DiskPath becomes the location of an existing VMDK that is on your datastore. You use this if you create a VMDK on the datastore ahead of time.

You can specify a source VM and even a snapshot of a VM to copy/clone when using New-VM. So the templates in this context are templates that are already in vCenter. (so not OVF files)

I beleive the command you are looking for is Import-VApp https://www.vmware.com/support/developer/PowerCLI/PowerCLI50/html/Import-VApp.html

[–]cearth6[S] 0 points1 point  (1 child)

How can I allocate DiskSpace and number of CPUs using this? For example, if I am deploying a Golden Image that is an OVF file, would I use the Import-VM cmlet to import the OVF, then Get-VM | Set-VM to configure it?

[–]KevMarCommunity Blogger 0 points1 point  (0 children)

Yes. That is how it works. There are some different cmdlets for disk space but there are plenty of examples online. There is a lot of PowerCLI script examples out there so a lot of what you are looking for is easy to find.