Quantcast
Channel: VMware Communities : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 178097

Deploy multiple VMs at the same time

$
0
0

Hello,

 

I am attempting to deploy multiple VMs at the same time using powercli.  I believe I need to had the -RunAsynch switch, howerver this does not appear to be working, instead the VMs are deploying one at a time.  Here is my code:

Connect-VIServer -Server vc1.MYDOMAIN.local -User MYDOMAIN\MYACCOUNT -Password MYPASSWORD

New-vm -vmhost prodh1.MYDOMAIN.local -Name TEST-SVR01 -Template W2K8R2SP1 -Datastore IOMEGA -OSCustomizationspec W2K8R2SP1 -Location _Tobedeleted| Start-VM -RunAsync

New-vm -vmhost prodh1.MYDOMAIN.local -Name TEST-SVR02 -Template W2K8R2SP1 -Datastore IOMEGA -OSCustomizationspec W2K8R2SP1 -Location _Tobedeleted| Start-VM -RunAsync

New-vm -vmhost prodh1.MYDOMAIN.local -Name TEST-SVR03 -Template W2K8R2SP1 -Datastore IOMEGA -OSCustomizationspec W2K8R2SP1 -Location _Tobedeleted| Start-VM -RunAsync

New-vm -vmhost prodh1.MYDOMAIN.local -Name TEST-SVR04 -Template W2K8R2SP1 -Datastore IOMEGA -OSCustomizationspec W2K8R2SP1 -Location _Tobedeleted| Start-VM -RunAsync

Start-Sleep -Seconds 300

get-vm "TEST-SVR01" | Get-VMGuestNetworkInterface -Guestuser Administrator -GuestPassword "MYPASSWORD" |?{$_.name -eq "Local Area Connection 3"} | set-vmguestnetworkinterface -Guestuser Administrator -GuestPassword "MYPASSWORD" -IPPolicy static -IP 192.168.1.25 -Netmask 255.255.255.0 -Gateway 192.168.1.1 -DNS 192.168.1.2,192.168.1.3 -RunAsync

get-vm "TEST-SVR02" | Get-VMGuestNetworkInterface -Guestuser Administrator -GuestPassword "MYPASSWORD" |?{$_.name -eq "Local Area Connection 3"} | set-vmguestnetworkinterface -Guestuser Administrator -GuestPassword "MYPASSWORD" -IPPolicy static -IP 192.168.1.25 -Netmask 255.255.255.0 -Gateway 192.168.1.1 -DNS 192.168.1.2,192.168.1.3 -RunAsync

get-vm "TEST-SVR03" | Get-VMGuestNetworkInterface -Guestuser Administrator -GuestPassword "MYPASSWORD" |?{$_.name -eq "Local Area Connection 3"} | set-vmguestnetworkinterface -Guestuser Administrator -GuestPassword "MYPASSWORD" -IPPolicy static -IP 192.168.1.25 -Netmask 255.255.255.0 -Gateway 192.168.1.1 -DNS 192.168.1.2,192.168.1.3 -RunAsync

get-vm "TEST-SVR04" | Get-VMGuestNetworkInterface -Guestuser Administrator -GuestPassword "MYPASSWORD" |?{$_.name -eq "Local Area Connection 3"} | set-vmguestnetworkinterface -Guestuser Administrator -GuestPassword "MYPASSWORD" -IPPolicy static -IP 192.168.1.25 -Netmask 255.255.255.0 -Gateway 192.168.1.1 -DNS 192.168.1.2,192.168.1.3 -RunAsync

Get-NetworkAdapter "TEST-SVR01" | Set-NetworkAdapter -NetworkName VM1 -Confirm:$false

Get-NetworkAdapter "TEST-SVR02" | Set-NetworkAdapter -NetworkName VM1 -Confirm:$false

Get-NetworkAdapter "TEST-SVR03" | Set-NetworkAdapter -NetworkName VM1 -Confirm:$false

Get-NetworkAdapter "TEST-SVR04" | Set-NetworkAdapter -NetworkName VM1 -Confirm:$false

 

Can anyone assist?

 

Thanks,

 

Duncan.


Viewing all articles
Browse latest Browse all 178097

Trending Articles



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