在 OnAfterInstall 中以其他用户身份启动进程被拒绝访问 [英] Starting a process as an other user in OnAfterInstall gets access denied

查看:37
本文介绍了在 OnAfterInstall 中以其他用户身份启动进程被拒绝访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在其他用户的上下文中启动 .bat 文件作为 OnAfterInstall 中的最后一步.我通过使用 Process.Start 重载以用户名、域和密码作为输入来执行此操作.如果我不检查安装中的所有人",它就可以正常工作.如果我选择了所有人",我的访问会被拒绝,并且是同一个用户(管理员).如果我使用 .start 方法运行分期付款,只需使用进程名称,它就可以正常工作.

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.

为了测试这一点,我制作了一个 Windows froms 应用程序,它在我使用Everyone"安装后以相同的方式启动进程,并且它工作正常.

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.

有谁知道为什么我无法在 OnAfterInstall 中使用其他用户上下文在选择了所有人"的情况下访问文件?

Does anyone know why I can't access the file in OnAfterInstall with 'Everyone' selected, using an other user context?

推荐答案

最有可能的是,当您检查每个人时,您告诉安装程序它不需要提升权限,因此它不会要求它们.即使您在 windows vista 或 7 中以管理员身份运行,您的进程令牌也是用户的,直到 UAC 提升您的权限.您需要一组策略才能调用 createprocessasuser 这是下面发生的事情.把上面api相关的所有policy给大家看看有没有用.

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.

这篇关于在 OnAfterInstall 中以其他用户身份启动进程被拒绝访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆