Process.Start() 和用户模拟
我有一个 MSI 安装程序自定义操作,它调用 Process.Start()
来运行批处理文件,该文件在内部执行大量操作,最后调用 iisreset
。但在少数计算机上,此操作会失败并出现访问被拒绝错误。有趣的是,运行 MSI 的用户可以从命令提示符执行 iisreset
。仅当通过我的流程执行时才会失败。
所以我想知道, Process.Start()
是否会以较低权限以当前用户身份生成新进程?如果是,我怎么能说以具有用户拥有的所有权限的同一用户身份运行呢?任何人都可以帮助我更好地理解这一点并诊断为什么会失败。
MSI created using : Visual Studio 2008
Server : Windows Server 2008
UAC Status : Off
错误消息
重新启动尝试失败。拒绝访问, 您必须是该网站的管理员 远程计算机使用此命令。 要么将您的帐户添加到 的管理员本地组 远程计算机或域 管理员全局组
任何帮助将不胜感激。
I have a MSI installer custom action which calls Process.Start()
to run a batch file which internally does lot of operations and finally calls iisreset
. But on few computers, this is failing with access denied error. Interestingly, the user running the MSI can do iisreset
from a command prompt. It only fails when executed through my process.
So I am wondering, is Process.Start()
spawning new process as the current user with less privileges? If yes, how can I say to run as the same user with all privileges user has? Can any one help me to understand this better and diagnose on why this fails.
MSI created using : Visual Studio 2008
Server : Windows Server 2008
UAC Status : Off
Error Message
Restart attempt failed. Access denied,
you must be an administrator of the
remote computer to use this command.
Either have your account added to the
administrator local group of the
remote computer or to the domain
administrator global group
Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该在您的自定义操作以避免最新 Windows 系统的用户访问控制功能出现问题。
有关详细信息,请参阅此博客。
You should set the msidbCustomActionTypeNoImpersonate flag (
0x800
) on your custom action to avoid issues with the User Access Control feature of recent Windows systems.See this blog for details.