| |
jcarver_14
Posts: 25
Score: 0
Joined: 6/4/2008
From: Cincinnati
Status: offline
|
Hi everyone, Very new to scripting (bout 3 mo.) so this might not be as pretty as some of your scripts but it may help someone. This will alow you to do a run as on just about anything but a folder. Just drag and drop onto the file. title = "User Name" title2 = "Password" message = "Please enter the user name." & vbCrLf & vbCrLf & "**NOTE**" & vbCrLf & vbCrLf & "User name must be entered as" & vbCrLf & "domain\username or username@domain.com" username=InputBox(message, title) message2 = "Please enter the password for:" & vbCrLf & vbCrLf & username password=InputBox(message2, title2) set wshShell=CreateObject("Wscript.Shell") set oShell= Wscript.CreateObject("WScript.Shell") wshShell.run("runas /noprofile /user:" & username & " " & Chr(34) & "cmd /c\" & Chr(34) & WScript.Arguments(0) & "\" & Chr(34) & Chr(34)) WScript.Sleep 100 wshShell.AppActivate "Runas" oshell.Sendkeys password & "~" Wscript.Quit Big down fall to this is you can see the password but it looks nice. If anyone knows how to fix that let me know. title = "User Name" message = "Please enter the user name." & vbCrLf & vbCrLf & "**NOTE**" & vbCrLf & vbCrLf & "User name must be entered as" & vbCrLf & "domain\username or username@domain.com" username=InputBox(message, title) set wshShell=CreateObject("Wscript.Shell") wshShell.run("runas /noprofile /user:" & username & " " & Chr(34) & "cmd /c\" & Chr(34) & WScript.Arguments(0) & "\" & Chr(34) & Chr(34)) WScript.Sleep 100 wshShell.AppActivate "Runas" Wscript.Quit This one does the same thing but it will alow you to put the password in in a dos window where you cant see it. set wshShell=CreateObject("Wscript.Shell") set oShell= Wscript.CreateObject("WScript.Shell") wshShell.run("runas /noprofile /user:username " & Chr(34) & "cmd /c\" & Chr(34) & WScript.Arguments(0) & "\" & Chr(34) & Chr(34)) WScript.Sleep 100 wshShell.AppActivate "Runas" oshell.Sendkeys "password" & "~" Wscript.Quit Replace usernames and password and it willl not prompt for anything... be careful though you dont want anyone to find your password.
|
|