开发者

Starting a process as an other user in OnAfterInstall gets access denied

开发者 https://www.devze.com 2022-12-17 13:43 出处:网络
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.

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开发者_JS百科 '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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号