Const JOIN_DOMAIN = 1 Const ACCT_CREATE = 2 Const ACCT_DELETE = 4 Const WIN9X_UPGRADE = 16 Const DOMAIN_JOIN_IF_JOINED = 32 Const JOIN_UNSECURE = 64 Const MACHINE_PASSWORD_PASSED = 128 Const DEFERRED_SPN_SET = 256 Const INSTALL_INVOCATION = 262144 Name = InputBox("Enter asset tag number:", "Identify Computer") Username = InputBox("Username:","Enter account with rights to the computer account,in format domainname\username") Password = InputBox("Pasword:", "Enter password") strComputer = "." 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(Name, Password, Username) If Err.Number = 0 Then WScript.Echo "Successfully renamed computer to " & name & "!" WScript.Echo "System will now restart for change to take effect!" Call Restart Else WScript.Echo "An error occurred renaming the computer!" WScript.Echo "Error Number: " & Err.Number WScript.Echo "Error" & Err.Description End If Next Sub Restart Dim wshShell Set wshShell = CreateObject("WScript.Shell") wshShell.Run "%WINDIR%\System32\shutdown.exe /r /t 0 /f /d p:2:4", 0 End Sub