werty1st

werty1st

Apr 2nd, 2009
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'CC werty1st 2009
  2.  
  3. 'runas wrapper
  4.  
  5. 'aufruf: cscript runaswrapper.vbs {username} {password} {"application [parameter]"}
  6.  
  7.  
  8.  
  9. option explicit
  10.  
  11. dim user,passwort,anwendung,WshShell
  12.  
  13.  
  14.  
  15.  
  16.  
  17. If Wscript.Arguments.Count = 3 Then
  18.  
  19.  
  20.  
  21.     user=Wscript.Arguments.Item(0)
  22.  
  23.     passwort=Wscript.Arguments.Item(1)
  24.  
  25.     anwendung=Wscript.Arguments.Item(2)
  26.  
  27.  
  28.  
  29.     WScript.StdOut.WriteLine("runas /user:"+user+" "+anwendung)
  30.  
  31.  
  32.  
  33.     set WshShell = CreateObject("WScript.Shell")
  34.  
  35.     WshShell.Run "runas /user:"+user+" "+""""+anwendung+""""
  36.  
  37.     WScript.Sleep 100
  38.  
  39.     WshShell.AppActivate "runas.exe"
  40.  
  41.     WshShell.SendKeys passwort+"{Enter}"
  42.  
  43.  
  44.  
  45. Else
  46.  
  47.     WScript.StdOut.WriteLine("Falsche Parameter angegeben.")
  48.  
  49. End If
  50.  
  51.  
  52.  
  53. 'DEMO BLOCK'
  54.  
  55. 'DEMO call: cscript runaswrapper.vbs administrator admin "notepad test2.txt"
  56.  
  57. 'WScript.Sleep 1000
  58.  
  59. 'WshShell.AppActivate "Unbenannt - Editor"
  60.  
  61. 'WshShell.SendKeys "Ich bin jetzt Admin{Enter}"
Advertisement
Add Comment
Please, Sign In to add comment