Archiv Server-Windows 15.877 Themen, 54.317 Beiträge

unterschiedliche IP Adresse: via Hardware- oder Benutzerprof

webharvey / 4 Antworten / Flachansicht Nickles

Hi,
ich habe nen Laptop der an 2 Standorten (ohne DHCP) mit
je 1 IP arbeiten muss. Bei A ist es 192.168.240.xxx bei B
mit 192.168.233.xxx. Wie kann ich das denn hinbekommen?
per Hardwareprofile oder Benutzerprofile?
thx
Marc

tele46 webharvey „unterschiedliche IP Adresse: via Hardware- oder Benutzerprof“
Optionen

Du kannst dir ein vbs scribt bauen, den du einfach doppelcklicken kannst und schon veschselt deine IP.
DHCP aktiviren;

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each objNetAdapter In colNetAdapters
errEnable = objNetAdapter.EnableDHCP()
If errEnable = 0 Then
Wscript.Echo "DHCP has been enabled."
Else
Wscript.Echo "DHCP could not be enabled."
End If
Next

Static IP

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
strIPAddress = Array("192.168.1.141")
strSubnetMask = Array("255.255.255.0")
strGateway = Array("192.168.1.100")
strGatewayMetric = Array(1)
For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
If errEnable = 0 Then
WScript.Echo "The IP address has been changed."
Else
WScript.Echo "The IP address could not be changed."
End If
Next
The System Administration Scripting Guide, part of the Windows .NET Server Resource


Viel Spass!!