Option Explicit Const USER = "Administrator" Const PASS = "secretpassword" Const WSNAME_COMMANDLINE = "\\MYSERVER\Tools\WSName /N:NEWNAME" Dim fso : Set fso = CreateObject("Scripting.FileSystemObject") Dim WSHShell : Set WshShell = CreateObject("WScript.Shell") Dim WshNetwork : Set WshNetwork = CreateObject("WScript.Network") Dim oDic : Set oDic = CreateObject("Scripting.Dictionary") Dim objArgs : Set objArgs = WScript.Arguments Dim oProcessEnv : Set oProcessEnv = WshShell.Environment("PROCESS") Dim sPathToRunAs, iReturnCode sPathToRunAs = oProcessEnv("SystemRoot")&"\System32\runas.exe" if Not fso.FileExists(sPathToRunAs) Then : WScript.Quit(1) 'Can't find RunAs iReturnCode=WshShell.Run("runas /user:" & USER & " " & CHR(34) & WSNAME_COMMANDLINE & CHR(34), 2, FALSE) Wscript.Sleep 40 ' Time for window to open. WshShell.AppActivate(sPathToRunAs)' Activate the Window WSHShell.SendKeys PASS & "~" ' Send the password