![](/img/trans.png)
[英]Run a Powershell Script as Administrator without any kind of prompt
[英]Run a PowerShell script with Administrator privileges on other computer
我的用户无权运行PowerShell.exe
使用C#我希望能够运行
(Get-Service -ComputerName 172.x.x.x -Name mssqlserver).Start()
在另一台计算机上,作为域管理员帐户。
我可以将PowerShell作为管理员的用户名和密码运行。
我在StackOverFlow中进行搜索...但是没有找到答案。
如果在执行应用程序时需要管理特权,则应在应用程序的清单文件中添加以下元素:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
为了执行PowerShell脚本,您还可以使用以下链接。 我以前使用过这个库,并且运行良好。 https://blogs.msdn.microsoft.com/kebab/2014/04/28/executing-powershell-scripts-from-c/
我找到了 !!!! 我建立我的应用程序并运行它来创建application.exe,然后以管理员身份运行它! 这样,我可以运行所有脚本而不会出现任何错误! :^)谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.