This is the code to fetch IP from XML and set to NIC,
I have vmtoolsd.exe in my windows environment path variable.
I have four dynamic properties defined IP, Mask, Gateway and DNS.
$command = @' cmd.exe /C vmtoolsd.exe --cmd "info-get guestinfo.ovfEnv" > C:\temp\poolip.txt '@ Invoke-Expression -Command:$command $cont = @() $cont = Get-Content c:\temp\poolip.txt $regex = [regex] "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" $ips = $regex.matches($cont) $dns = $ips[0].value $ipaddr = $ips[1].value $mask = $ips[2].value $gateway = $ips[3].value Invoke-command{ netsh interface ip set address "Local Area Connection" static $ipaddr $mask $gateway netsh interface ip add dns "Local Area Connection" $dns}
Thanks Again!