VMware Cloud Community
sradnidge
Enthusiast
Enthusiast
Jump to solution

PowerShell New-VM errs :(

Hopefully it's not me being stupid, but I'm continually getting errs trying to create a VM using an existing disk via PowerShell. Se attached for commands and output... I dont think I am doing anything wrong there? Bit puzzled as to how the device spec could be wrong when I'm using a disk that was just created using the same guest type!

0 Kudos
1 Solution

Accepted Solutions
admin
Immortal
Immortal
Jump to solution

The path doesn't look right.

With the VM you created could you try

get-vm <yourvm> | get-view | select { $_.Config.Files.VmPathName }

and feed that path to new-vm? You'll have to put the path in quotes since it has spaces.

View solution in original post

0 Kudos
3 Replies
admin
Immortal
Immortal
Jump to solution

The path doesn't look right.

With the VM you created could you try

get-vm <yourvm> | get-view | select { $_.Config.Files.VmPathName }

and feed that path to new-vm? You'll have to put the path in quotes since it has spaces.

0 Kudos
sradnidge
Enthusiast
Enthusiast
Jump to solution

Cheers Carter, will try that when i get in tomorrow. I too thought the path looked wierd, but I actually get an "invalid path" type err when I don't include the square brackets. It does seem to be finding the vmdk though, otherwise it how would it know to throw back an invalid type? Can I assume the 1 in the err refers to the persistence state of the disk or something?

Cheers

Stu

0 Kudos
sradnidge
Enthusiast
Enthusiast
Jump to solution

nice one Smiley Happy

It doesn't want a slash after the datastore name, replacing the slash with a space and surrounding the diskpath with quotes did the trick!

new-vm -Name testpowershell -DiskPath "[local] disk0.vmdk" -GuestId winXPProGuest

0 Kudos