BillM
Posts: 20
Joined: Thu Jan 08, 2015 3:35 pm

SOLVED: Powershell Inline works for system32 GUI apps but not console apps

This is a weird one.

I need to run a small Powershell inline script that does some stuff and then calls pnputil.exe. My inline script works fine when run from a PS prompt. When I compile and run my setup, it fails and does a rollback. The log says file not found for pnputil.exe.

During debugging, I tried to simplify everything. I deleted the entire script and just had notepad.exe as the inline script. At runtime, Notepad pops up just fine. I also tried the same experiment with wscript.exe. It's GUI pops up just fine. When I try it with just pnputil.exe, I get file not found. When I try it again with another console application (audiodg.exe) I also get a file not found.

So I'm completely confused now. Does anyone have any clue as to why GUI apps from \Windows\system32 work just fine when called by an inline PS script, but console apps fail?

Solution: In Advanced Installer the Powershell Script Options setting for Platform defaults to x86. When I changed it to x64, it worked.
Liviu
Posts: 1077
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: SOLVED: Powershell Inline works for system32 GUI apps but not console apps

Hello,

Thank you for your followup on this.

It's great to hear that everything is now working as expected.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”