strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\" & strComputer & " ootcimv2")
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
strSubnetMask = Array("255.255.0.0")
strGateway = Array("100.100.100.1")
strGatewayMetric = Array(1)
For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
Next
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\" & strComputer & " ootcimv2")
("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
arrDNSServers = Array("100.100.11.1")
objNetCard.SetDNSServerSearchOrder(arrDNSServers)
Next
' 03 修改固定winsserver
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\" & strComputer & " ootcimv2")
("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
strPrimaryServer = "100.100.11.1"
strSecondaryServer = " "
objNetCard.SetWINSServer strPrimaryServer, strSecondaryServer
Next
Password = "ppp"
Username = "administrator"
Set objWMIService = GetObject("Winmgmts:rootcimv2")
For Each objComputer in _
objWMIService.InstancesOf("Win32_ComputerSystem")
Next
strComputer = "."
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\"&_
strComputer & " ootdefault:StdRegProv")
strValueName = "NV Domain"
strValue = "dns name"
HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue)
If (Return = 0) And (Err.Number = 0) Then
End If
' 06 修改dns后缀
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\" & strComputer & " ootcimv2")
arrDNSSuffixes = Array("global.test.com", "global.arup.com")
objNetworkSettings.SetDNSSuffixSearchOrder(arrDNSSuffixes)
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\" & strComputer & " ootcimv2")
("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
objNetCard.SetDNSDomain("test.com")
Next
' 08
Set ooReg=GetObject( _
"winmgmts:{impersonationLevel=impersonate}!\" &_
strComputer & " ootdefault:StdRegProv")
strKeyPath = "SYSTEMControlSet001ServicesTcpipParameters"
strValueName = "SyncDomainWithMembership"
ooReg.SetDWORDValue _
HKEY_LOCAL_MACHINE,strKeyPath,strValueName,0
If Err = 0 Then
ooReg.GetDWORDValue _
HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
End If
Set oooReg=GetObject( _
"winmgmts:{impersonationLevel=impersonate}!\" &_
strComputer & " ootdefault:StdRegProv")
strKeyPath = "SYSTEMControlSet001ServicesTcpipParameters"
strValueName = "SyncDomainWithMembership"
oooReg.SetDWORDValue _
HKEY_LOCAL_MACHINE,strKeyPath,strValueName,0
If Err = 0 Then
End If
strComputer = "."
Set ooooReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\" & strComputer & " ootdefault:StdRegProv")
strKeyPath = "SYSTEMControlSet001ServicesTcpipParametersInterfaces"
ooooReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
' subkey就是目录名字
strKeyPath2 = "SYSTEMControlSet001ServicesTcpipParametersInterfaces" & subkey
strValueName2 = "RegisterAdapterName"
ooooReg.SetDWORDValue _
HKEY_LOCAL_MACHINE,strKeyPath2,strValueName2,1
' 11 wait
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\"&_
strComputer & " ootdefault:StdRegProv")
strKeyPath = "SOFTWAREMicrosoftWindowsCurrentVersionRun"
strValueName = "BAT"
strValue = "C: emp1.5.vbs"
HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue)
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!\" & _
strComputer & " ootcimv2")
("Select * from Win32_OperatingSystem")
objOperatingSystem.Reboot()
Next