作者:Smitty | 来源:互联网 | 2022-12-12 18:32
我正在尝试重命名计算机并通过运行Vbscript为它们分配静态IP.将从文本文件中读取名称和IP.
我在Windows 7上成功使用了以下脚本,但它在Windows 10上不起作用
要重命名Windows 7计算机:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersOnationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputers = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
Dim objComputer 'as Win32_ComputerSystem
For Each objComputer In colComputers
err = objComputer.Rename("NewName")
Next
要设置Windows 7静态IP:
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
strIPAddress = Array("192.168.1.xxx")
strSubnetMask = Array("255.255.255.x")
strGateway = Array("192.168.1.xxx")
strGatewayMetric = Array(1)
我找不到适用于Windows 10的脚本版本.