程序编写中经常指定,程序已非登录用户权限执行,来实现一些特殊的功能,用户的权限切换可以使用微软的自带工具Runas 实现,然而该工具的使用是交互式的带来的诸多不便。
VBS可以实现模拟键盘输入和延时相应等功能可以和 Runas配合实现非交互式提权
- dim WshShell,cmd
- cmd="%SystemRoot%\system32\cmd.exe"
- SetWshShell=WScript.CreateObject("WScript.Shell")
- WshShell.Run cmd
- WScript.Sleep 100
- WshShell.SendKeys"runas /netonly /user:SUS_LENOVO\liuming1 cmd"
- WshShell.Sleep 200
- WshShell.SendKeys"adlife1983"
- WScript.Sleep 2000
- WshShell.SendKeys"{ENTER}"
转载于:https://blog.51cto.com/makeitcometrue/539489