修改计算机名脚本
Dim revalSet objnet = CreateObject ("WScript.Network")
Set R = CreateObject("WScript.Shell")
reval = InputBox ("当前的计算机名是:" & objnet.ComputerName,"输入新的计算机名")
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colComputers = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colComputers
errReturn = ObjComputer.Rename (reval)
If reval <> "" Then
return=MsgBox ("你确定要重起计算机吗?",vbokcancel+vbexclamation,"注意!")
If return=vbok Then
R.run("Shutdown.exe -r -t 0")
End if
End If
Next
页:
[1]