Hoping someone has used Powercli to automate adding a new "Organization VDC network", choose an "Adapter Type", change the "IP Mode" to manual, and populate the "IP Address" into vCD 5.1
Any help would be appreciated!!
Basic uncompleted script below so you get an idea of what I'm trying to accomplish.. Basically the entire import into vCloud, but I get stuck at the NIC configuration portion.
#Add correct Snapins for vCenter Server, and vCloud Director
Add-PSSnapin VMware.VimAutomation.Core
Add-PSSnapin vmware.vimautomation.cloud
clear
#Predefined Variables
$ciServer1 = 'ciserver1'
$ciServer2 = 'ciserver2'
$viServer1 = 'vcenterserver1'
$viServer2 = 'vcenterserver2'
$ciName = $viName
$vApp = $ciName
#Prompts
$viName = Read-Host "VM Guest?"
$org = Read-Host "VM Organization?"
$viServer = Read-Host "Virtual Center Name?"
$location = Read-Host "location 1, or location 2?"
$ciNetwork = Read-Host "VDC_Network_Name?"
$ciNetwork2 = Read-Host "VDC_Network_Name2?"
$ciNetworkIP = Read-Host "Network 1 IP?"
$ciNetworkIP2 = Read-Host "Network 2 IP (Press Enter for NULL)?"
if ($location -eq 'location 1')
{
$ciServer = $ciServer1
$viServer = $viServer1
}
else
{
$ciServer = $ciServer2
$viServer = $viServer2
}
#Connecting to Virtual Center, and vCloud Director
Connect-VIServer -Server $viServer
Connect-CIServer -Server $ciServer
#Import Process
Import-CIVApp -VM (Get-VM $viName) -OrgVdc $org -NoCopy:$True -RunAsync #-Confirm $false
Start-Sleep -s 30
$ciName | Get-CINetworkAdapter | Set-CINetworkAdapter -vappnetwork $ciNetwork -IPaddressAllocationMode:Pool -Connected:$True
Set-NetworkAdapter -NetworkAdapter $ciNetwork -WakeOnLan:$true -StartConnected:$true -Connected:$true
Start-Sleep -s 30
#Starting VM Guest through vCloud Director
Start-CIVM -VM $viName
#Disconnecting from vCenter, and vCloud Director
Disconnect-VIServer -Server $viServer -Confirm:$false
Disconnect-CIServer -Server $ciServer -Confirm:$false
#Pop-up indicating the script has finished
$a = new-object -comobject wscript.shell
$b = $a.popup("Script has completed",0,"Script has completed",1)