Is it possible to modify the IP address and associated settings using vCO without doing a full guest customization? If so, could someone provide an example?
The scenario that I have is that during a server provision, the server must initially be placed in a "provisioning" VLAN and assigned a static IP. Then after certain tasks are completed, the VM needs to be relocated to a "final" VLAN and assigned a new static IP address.
Thanks!
You can use guest operations workflows "run program in guest" to run a script / command to change the IP.
Any ideas on how to get this to function in Windows 2008 R2 by using a local account with membership to the Administrators group instead of using the built in Administrator account? I can utilize c:\windows\system32\netsh.exe by using the "Run program in guest" workflow under the built in Administrator, but no other account will work. Disabling UAC doesn't affect the outcome.
I haven't tried it, but tools like PsExec could be useful for remote execution.
Hi,
i have solved this by running a powershell script using the 'Run Programm in Guest'. The script is copied to the guest and than gets executed. As the identifier for which network card to configure i use the MAC address of the network card.
The script looks like this:
[CmdletBinding()]
param (
[parameter(Mandatory=$true,Position=1)]
[string]$mac="xxxxx",
[parameter(Mandatory=$true,Position=2)]
[string]$ip="",
[parameter(Mandatory=$true,Position=3)]
[string]$netmask="",
[parameter(Mandatory=$false,Position=4)]
[string]$gw="",
[parameter(Mandatory=$false,Position=5)]
[string]$dnslist=""
)
if (!(Test-Path("c:\temp\"))) {
New-Item "c:\temp\" -type directory
}
start-transcript c:\temp\ConfigureNetwork.log
$NIC = Get-WmiObject Win32_NetworkAdapterConfiguration | where {$_.MACAddress -eq "$mac"}
if ($NIC) {
"Configure adapter"
if (!$ip) {
"Ip not given"
exit 1
}
"Using IP $ip"
if (!$netmask) {
"Netmask not given"
exit 2
}
"Using netmask $netmask"
$NIC.EnableStatic($ip, $netmask)
if ($gw) {
"Using default gw $gw"
$NIC.SetGateways($gw)
}
if ($dnslist) {
"Using dnsserver $dnslist"
$DNSServer = @();
foreach ($server in $dnslist.split(",")) {
$DNSServer += $server
}
$NIC.SetDNSServerSearchOrder($DNSServer)
}
$NIC.SetDynamicDNSRegistration("FALSE")
} else {
"Netwokcard not found"
exit 10
}
exit 0
Stop-Transcript
Thomas
Hi,
In my workflow i am using "run program in a guest" but just before this workflow i defined my environnement variable.
basically i run this command inside the VM :
c:\windows\system32\cmd.exe /c
Programpath :c:\windows\system32\cmd.exe
Argumentpath : netsh interface ip set address name="Local Area Connection" static IP netmask gateway 1 & dns1 & dns2
But in my workflow it is a little more complicated because IP , netmask etc.. are variable that i defined before (using scriptable task).
Regards,
Julien.