I have written a basic script to connect a virtual machines network status to both Connected & Connect at power on. The script appears to run fine without any errors. However when i check a system the network box is still unchecked. Here is the script:
#Script to connect a virtual machines network card
$cred = Get-Credential
Connect-VIServer server.domain.com -Credential $cred
$machines = Get-VM
foreach ($machine in $machines)
{
Set-NetworkAdapter -NetworkAdapter 'Network adapter 1' -Networkname 'Organisation LAN' -StartConnected:$true -Connected:$true
}
Disconnect-VIServer -Confirm:$false