我在桌面上有一个应用程序的快捷方式;应用程序根据用户权限工作不同。我想要的是从较少特权的用户调用快捷方式,并自动访问管理员帐户,将管理员的密码隐藏到当前用户。通过这种方式,普通用户可以访问应用程序中的更多选项,而无需了解其他用户的帐户数据。
我尝试过创建bat文件,但可以很容易地看到密码。我正在寻找使用VB的方法,但我不确定这是否是最好的选择。这个软件做我想要的,事情是不是免费的。
https://4sysops.com/archives/run-a-program-with-administrator-rights-runasspc-cpau-and-steel-run-as-compared/ http://www.robotronic.de/runasspcEn.html
感谢您的帮助。
答案 0 :(得分:0)
#Create a Desktop Shortcut with Windows PowerShell
If(!$ShortcutFileName)
{
$ShortcutFileName = (Get-Item $TargetFile).Basename
}
$ShortcutFile = "$env:Public\Desktop\$ShortcutFileName.lnk"
$WScriptShell = New-Object -ComObject WScript.Shell
$Shortcut = $WScriptShell.CreateShortcut($ShortcutFile)
#Run as different user, saves the password
$a="runas.exe /savecred /user:$RunAsUser ""$TargetFile"""
$Shortcut.TargetPath = "runas.exe"
$Shortcut.Arguments = "/savecred /user:$RunAsUser ""$TargetFile"""
$Shortcut.IconLocation = $TargetFile
$Shortcut.Save()
您可以从how to create a shortcut to run an application as a different user(PowerShell)
下载详细的SQL脚本