我在不允许本地pipe理员权限的环境下工作。 完全一样。 这是非常好的,但是当员工必须具有本地pipe理员权限才能运行程序或安装需要提升特权的软件时,也可能会很痛苦,即使只进行安装。 有一个记帐用户从我们的供应商处收到每月的DVD,其中包含非常需要的报告。 为了查看报告并进行备份,她必须在DVD上运行可执行文件。 可执行文件需要pipe理员权限进行安装。 所以,因为我一直在这里,每个月我运行.exe,UAC出现,我提供了急需的信息来运行安装程序。
如果这是一次性程序,我会使用微软应用程序兼容性工具包噱头绕过UAC http://www.techrepublic.com/blog/windows-and-office/selectively-disable-uac-for-your-trusted-vista – 应用程序/然而,因为这是一个每月发送给她的新DVD,我需要某种工具,她可以使用自己的这个操作。
我环顾了服务器故障,也做了谷歌福,但没有发现任何有用的东西。 我可能是一个独特的情况之一。
我想用Poweshell来制作这个工具。 理想情况下,我希望她能够放入DVD,然后启动Poweshell工具(从桌面快捷方式,毫无疑问)看DVD驱动器,并运行setup.exe文件作为本地pipe理员没有UAC提示,而无需她提供任何证件。
到目前为止,我所拥有的一些东西是拼凑在一起的。 我不是一个Powershell绝地。 我是一个Poweshell padawan。 我有我需要的一半。 我仍然需要存储密码,所以每次运行脚本时都不必定义和input密码。 我希望这是尽可能平滑和尽可能less的点击。
对于我select与本地pipe理员帐户,因为该密码不会改变的信用。 本地pipe理员帐户将完成工作。 我需要将该帐户信息存储在计算机上,以便Powershell每次运行该脚本时都可以检索该帐户。 所以这将需要一个pathvariables中的encryption文件。
# define path to store password and input password $path = "C:\Users\User\Password folder" # get the encrypted local admin password from user path $encpwd = Get-Content $path\admin.bin # convert admin file to secure string $passwd = ConvertTo-SecureString $encpwd # define local admin credential $cred = new-object System.Management.Automation.PSCredential 'computer name\local admin',$passwd # go to DVD drive launch setup.exe as local admin with no user input required Set-Location D:\ Start-Process PowerShell -Cred $cred -ArgumentList .\setup.exe
我可能会为此得到一些提示,但是我知道需要在某个地方定义并在“Read-Host”中放入一些关于在现有variables或新variables中input密码“-AsSecureString”的文本。 我必须将密码input到过程中。 我已经尝试了几个点。 思考? 智慧? 不可能?
Windows 7专业版Powershell v4
允许非pipe理员用户以本地pipe理员帐户运行程序,但不提示提升
以下是设置一个解决方法以使应用程序作为另一个本地pipe理员帐户运行的说明。 但是,执行该过程的帐户不需要是PC上的本地pipe理员。
创build用户名示例(域或本地): ProxyRunAsLocalAdmin
创build密码示例(域或本地): <SomeComplexPassword>
笔记
这个帐户设置为PC上的local admin
,需要使用pipe理员权限运行某些内容,而不实际给予将运行(执行)本地pipe理员权限的最终用户。
对于那些不允许在本地机器上工作的非pipe理员来说,这是一个最后的select,在这个机器上,给他们的帐户(最终用户和/或某个组)明确的registry
和file system
级别的对象访问不起作用。
安全
创buildRUNAS的快捷方式(我假设这可能是D:\Setup.exe
)
这里的语法是一个工作的例子。 。 。
快捷方式Properties
示例:
TARGET
字段示例(如下):
%systemroot%\system32\runas.exe /user:domain\ProxyRunAsLocalAdmin /savecred "C:\Program Files\BlueStacks\HD-StartLauncher.exe"
START IN
示例: "C:\Program Files\BlueStacks"
重要: 无论path中是否有空格,都可能需要“ 开始位置”字段中的双引号。
其他安装说明
安全说明
控制
尽pipe如此,您确实已经有了一些适用于此解决scheme的控件。 。 。
我find了一个用Powershell实现目标的方法。 首先,脚本必须在用户计算机上运行(仅一次),以制作encryption的密码,然后将其存储到文件中。 注意:存储的密码文件不是包含纯文本本地pipe理员密码的txt文件。 它是ConvertFrom-SecureString cmdlet的输出。
首先,脚本input密码并将其存储到文件中。 这只需要在目标计算机上运行一次。
# Enter encrypted password once and store to file; define variables $path = "C:\Folder\Folder\" $passwd = Read-Host "enter desired password" -AsSecureString $encpwd = ConvertFrom-SecureString $passwd $encpwd > $path\filename.bin
现在,用户将运行从dvd启动程序的脚本作为本地pipe理员。 在将DVD插入光盘驱动器后,她将从桌面快捷方式运行脚本。 启动脚本后,程序运行完美,她可以做到这一点,而不问我或其他pipe理员的帮助(她爱)。
# define path to store password and input password $path = "C:\folder\folder" # get the encrypted password from the path $encpwd = Get-Content $path\filename.bin # convert file to secure string $passwd = ConvertTo-SecureString $encpwd # define needed credential $cred = new-object System.Management.Automation.PSCredential 'computer name\account name',$passwd # go to DVD drive launch setup.exe as user with privileges to launch the program with no user input required Set-Location D:\ Start-Process PowerShell -Cred $cred -ArgumentList .\setup.exe
这Powershell.org文章有助于得到我的答案http://powershell.org/wp/2013/11/24/saving-passwords-and-preventing-other-processes-from-decrypting-them/
那么,谢谢你,如果你消除本地pipe理员,你剩下的唯一真正的select是CMD线。 Powershell是好的,但我想你也可以用这个来运行批处理。
如果用户知道如何打开脚本,她可以看到你在其中放置了什么,这是一个巨大的不是。 唯一的解决办法是在代码中编写一个命令,在打开时locking脚本,而不是执行,以提示input密码。
也许一个批处理或PowerShell专门写地址UAC?