Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'CC werty1st 2009
- 'runas wrapper
- 'aufruf: cscript runaswrapper.vbs {username} {password} {"application [parameter]"}
- option explicit
- dim user,passwort,anwendung,WshShell
- If Wscript.Arguments.Count = 3 Then
- user=Wscript.Arguments.Item(0)
- passwort=Wscript.Arguments.Item(1)
- anwendung=Wscript.Arguments.Item(2)
- WScript.StdOut.WriteLine("runas /user:"+user+" "+anwendung)
- set WshShell = CreateObject("WScript.Shell")
- WshShell.Run "runas /user:"+user+" "+""""+anwendung+""""
- WScript.Sleep 100
- WshShell.AppActivate "runas.exe"
- WshShell.SendKeys passwort+"{Enter}"
- Else
- WScript.StdOut.WriteLine("Falsche Parameter angegeben.")
- End If
- 'DEMO BLOCK'
- 'DEMO call: cscript runaswrapper.vbs administrator admin "notepad test2.txt"
- 'WScript.Sleep 1000
- 'WshShell.AppActivate "Unbenannt - Editor"
- 'WshShell.SendKeys "Ich bin jetzt Admin{Enter}"
Advertisement
Add Comment
Please, Sign In to add comment