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

Re: Change network setting on VM

$
0
0


Hi,

 

I have create an action to change port group and it's working but now I need to change the network settings on guest (IP, subnetmask, gateway)

I give you my little action :

var psScript = ''

psScript +='Add-PSSnapin VMware.VimAutomation.Core\n';

psScript +='$username = "USERNAME"\n';

psScript +='$password = "PASSWORD"\n';

psScript +='\n';

psScript +='Connect-VIServer -Server "VCENTERSERVER" -User $username -Password $password\n';

psScript +='Get-VM '+ VMNAME + ' | Get-NetworkAdapter | Set-NetworkAdapter -NetworkName "PORTGROUP" -Confirm:$false\n';

psScript +='Disconnect-VIServer -Confirm:$False\n';

return System.getModule("com.vmware.library.powershell").invokeScript( host,psScript,sessionId) ;


Viewing all articles
Browse latest Browse all 169668

Trending Articles



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