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

Re: Changing IPs with Invoke-vmscript

$
0
0

Try this:

 

$out =  Invoke-VMScript -VM $vm -GuestUser $user -GuestPassword $password -scripttext "netsh interface ip show config"
$m = $out | Select-String -pattern "Local Area Connection \d+"

 

  if ($m) {
     $interface = $m.matches[0].value
     if ($interface -ne $null) {
       $cmd = "netsh interface ip set address name='$interface' static $ip"

       $out = Invoke-VMScript -VM $vm -GuestUser $user -GuestPassword $password -scripttext $cmd

     }

  }


Viewing all articles
Browse latest Browse all 293210

Trending Articles



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