简体   繁体   中英

PowerShell script to run an exe using the Local System Account

I am facing an issue with some installation using the Local System Account.

I stumbled upon the following post : Is it possible to execute a custom action in WiX that is a managed .EXE file?

The first comment explains my situation accurately - "One other thing to note is that deferred actions run under the context of the system account, so if the exe requires access to a profile for any reason, this will cause it to fail. I had this very issue when trying to generate a certificate as part of my install."

The solution that was suggested was to spawn PowerShell using -RunAs switch and run a script to call the exe.

I have no knowledge of PowerShell. So I need help coming up this script.

If you want to run something as the local system account, the only way I know is to use psexec -s . There are some very complicated ways to do it through permanent WMI event consumers but that's way overkill.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM