Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

configure IP

$
0
0

Hi,

 

After adding a new network adapter to a virtual machine I try to configure its network configuration with "run program in guest" (I don't want to perform a sysprep process)

I use the following arguments:

arguments = "-command \"& {$nic = get-wmiobject win32_networkadapter | where {($_.netconnectionid -like \"local*\") -or ($_.netconnectionid -like \"Ethernet*\")}; $nicToChange = $nic.netconnectionid; c:\\windows\\system32\\netsh.exe interface ip set address \"$($nicToChange)\" static " + IP + " " + subnet + " " + defaultGateway + " 1}"

 

this command should work with powershell 2.0 only.

If I copy this command to a powershell window in the virtual machine it change the IP.

If a pass a simple command like write-host hello worls | out-file c:\\hello.txt it works fine.

 

Where is my mistake?

There is an easier way to perform this?

 

Thanks!


Viewing all articles
Browse latest Browse all 6251

Trending Articles