Hi, I am new to PowerCli. I need to write a script to switch VM's network from internal to public . Can anyone help me how to do this using PowerCLI cmdlet ?
Thanks.
This should do the trick
$tgtPg = <internal-portgroup-name> $newPg = <public-portgroup-name> Get-VM | %{ $net = $_ | Get-NetworkAdapter | where {$_.NetworkName -eq $tgtPg} $net | Set-NetworkAdapter -NetworkName $newPg -Confirm:$false }
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thanks..by the way, how do you change VM's IP address ?