在 OnAfterInstall 中以其他用户身份启动进程时访问被拒绝
我正在尝试在其他用户的上下文中启动 .bat 文件作为 OnAfterInstall 的最后一步。我通过使用 Process.Start 重载以及用户名、域和密码作为输入来完成此操作。如果我不检查安装中的“每个人”,它就可以正常工作。如果我选择了“所有人”,则同一用户(管理员)的访问会被拒绝。如果我使用 .start 方法仅使用进程名称运行安装,它就可以正常工作。
为了测试这一点,我制作了一个 Windows froms 应用程序,在使用“Everyone”安装后以相同的方式启动该过程,并且运行良好。
有谁知道为什么我无法使用其他用户上下文访问 OnAfterInstall 中选择“所有人”的文件?
I'm tryning to start a .bat file as the last step in OnAfterInstall in the context of an other user. I'm doing this by using the Process.Start overload with user name, domain and password as input. It works fine if I do not check the 'Everyone' in the installation. If i have the 'Everyone' selected I get access denied, with the same user (administrator). If I run the installment using the .start method with just the proccess name it work fine.
To test this I made a Windows froms application that start the proccess the same way after I install using 'Everyone', and it works fine.
Does anyone know why I can't access the file in OnAfterInstall with 'Everyone' selected, using an other user context?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最有可能的是,当您检查每个人时,您告诉安装程序它不需要提升权限,因此它不会要求它们。即使您在 Windows Vista 或 7 中以管理员身份运行,您的进程令牌也是用户的令牌,直到 UAC 提升您的权限。您需要能够调用一组策略 createprocessasuser 这就是下面发生的事情。把上面api相关的所有策略都给大家,然后看看行不行。
Most likely when you check everyone you are telling the install program it doesn't need elevate permissions so it doesn't ask for them. Even when you run as an admin in windows vista or 7 your process token is that of a user until the UAC elevates you. There are a set of polices you need to be able to call createprocessasuser which is what is happening underneath. Give all polices related to the above api to everyone and then see if it works.