Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 192300

Re: Using Powercli I having trouble modifying vm hardware and nic portgroup when deploying from template

$
0
0

That is because you run the New-VM with the RunAsync switch.

The VM will be created, but the script will immediately continue. Which means the VM is not yet created when the script reaches the Set-VM cmdlet.

You will have to build in a loop to wait till the VM is actually created.

 

You could do something like this

New-VM -Name $_."Server Name" ....

while(!(Get-VM -Name $_."Server Name" -ErrorAction SilentlyContinue)){

   sleep 5

}

Set-VM -VM $_."Server Name" ....


Viewing all articles
Browse latest Browse all 192300

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>