local $SYSTEM_KEY = 'HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/'; local $TCP_KEY = 'Services/Tcpip/Parameters/Interfaces'; ########## Set IPs Masks and Gateways ########## for($i=0;$i<=$#nicids;$i++) { $tempkey = $SYSTEM_KEY.$TCP_KEY."\/".$nicids[$i]; $key = $Registry->Connect($machine, $tempkey); if (!$key) { print "ERROR: unable to connect to registry on machine $machine for TCP_KEY \n$tempkey\n"; } $key->{'/IPAddress'} = $newnicips[$i]; $key->{'/SubnetMask'} = $newnicmasks[$i]; $key->{'/DefaultGateway'} = $newnicgateways[$i]; ####### Update the currently active location too ######### $tempkey = $SYSTEM_KEY."Services\/".$nicids[$i]."\/Parameters/Tcpip"; $key = $Registry->Connect($machine, $tempkey); if (!$key) { print "ERROR: unable to connect to registry on machine $machine for TCP_KEY \n$tempkey\n"; } $key->{'/IPAddress'} = $newnicips[$i]; $key->{'/SubnetMask'} = $newnicmasks[$i]; $key->{'/DefaultGateway'} = $newnicgateways[$i]; }