重命名计算机名.vbs

strComputer = InputBox("请输入计算机名或者IP地址", "输入")
strNewname = InputBox("请输入新计算机名", "输入")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputers = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colComputers
err = ObjComputer.Rename(strNewname)
Wscript.Echo err
Next

你可能感兴趣的:(计算机)