VMware Cloud Community
VicMware
Contributor
Contributor

Move VM to blue folder and PowerCLI syntax problem

Hi

1. Whats the command to move a VM to a newly created blue folder?

2. See screenshot. Any idea why I am getting those errors?

Capture.PNG

0 Kudos
1 Reply
RvdNieuwendijk
Leadership
Leadership

To move a VM to another folder you can use the Move-VM cmdlet:

Move-VM -VM VM -Destination (Get-Folder -Name Folder)


The first error in the screenshot indicates that the value of the CapacityGB parameter must be a size. For example -CapacityGB 100 to create a hard disk 100 GB large. In your script $harddisk2 and $harddisk3 are probably not a size.

The second error says that you cannot pass a string in the pipeline to the New-Harddisk cmdlet. You can modify the the commands into:

Get-VM -Name $Name | New-HardDisk -CapacityGB $harddisk2size -Datastore $Datastorename2 -Persistence Persistent
Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos