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

Network customization using powerCLI

$
0
0

Hello all,

 

I'm brand new to scripting and I'm not sure why I seem to have to run these two commands separately:

 

get-vm "MYTESTVM" | Get-VMGuestNetworkInterface -Guestuser Administrator -GuestPassword MYPASSWORD |?{$_.name -eq "Local Area connection 4"} | set-vmguestnetworkinterface -Guestuser Administrator -GuestPassword MYPASSWORD -IPPolicy static -IP 10.244.186.113 -Netmask 255.255.255.0 -Gateway 10.244.186.1 -DNS 10.244.37.25,10.244.37.26

 

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

 

The code works if I run it line by line.  But it doesn't work if I try this:

 

get-vm "MYTESTVM" | Get-VMGuestNetworkInterface -Guestuser Administrator -GuestPassword MYPASSWORD |?{$_.name -eq "Local Area connection 4"} | set-vmguestnetworkinterface -Guestuser Administrator -GuestPassword MYPASSWORD -IPPolicy static -IP 10.244.186.113 -Netmask 255.255.255.0 -Gateway 10.244.186.1 -DNS 10.244.37.25,10.244.37.26 | Get-NetworkAdapter "TEST-SVR01" | Set-NetworkAdapter -NetworkName VLAN186_QA -Confirm:$false

 

Any suggestions?

 

Thanks.


Viewing all articles
Browse latest Browse all 176483

Trending Articles



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