Description : Ce script VBS assigne l'adresse IP 192.168.1.69 avec un masque 255.255.255.0 et une passerelle 192.168.1.100 à un ordinateur.
Script :
strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _ ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
strIPAddress = Array("192.168.1.69") strSubnetMask = Array("255.255.255.0") strPasserelle = Array("192.168.1.100") strGatewayMetric = Array(1)
For Each objNetAdapter in colNetAdapters errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask) errGateways = objNetAdapter.SetGateways(strPasserelle, 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
Proposer un script
|
Notre avis :

Votre avis :

Réactions : 0
Votants : 5
Visites : 16393
|