Code signing and powershell scripts for AllSigned group policy - Advanced Installer Community
swferrar
Posts: 4
Joined: Wed Jan 25, 2023 7:25 pm

Code signing and powershell scripts for AllSigned group policy

The newest version of my installer more heavily relies on powershell scripts, and we have recently had complaints from some customers with more hardened systems that they were unable to run the installer due to them not being signed. We have ticked the box to sign our PS scripts, and the installer itself is signed, but we are still getting errors related to the powershell scripts being unsigned:

Code: Select all

[INFO] PowerShell script preferred invocation folder: 
Dumping PowerShell invoke log ...
--> Found PowerShell path: C:\WINDOWS\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
--> PowerShell Script Execution Result Code: 1
--> PowerShell Script Execution log: 
AuthorizationManager check failed.
    + CategoryInfo          : SecurityError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnauthorizedAccess
CustomAction My_Script returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 13:02:24: My_Script. Return value 3.
Action ended 13:02:24: INSTALL. Return value 3.
MSI (s) (C4:2C) [13:02:24:498]: Product: My_Installer -- Installation failed.
I found a thread discussing what appears to be the same problem, but the specific section of the guide is no longer there. They mention that with the "AllSigned" group policy scripts themselves will not appear signed unless the certificate is present in the "Trusted Publisher", but I cannot find any clear instructions on how to transfer the certificate here. I am using one of the EToken dongle certificates attached to a remote CI machine, so my ability to try out solutions is a little limited. It looks like this may be related to the "Generate and install a self signed certificate" custom action, will this use the certificate provided to the installer as a whole? Do I need to specify a specific property, it defaults to AI_THUMBPRINT_PROP.

Any help would be appreciated!
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: Code signing and powershell scripts for AllSigned group policy

Hello,

I have run some tests on my end and it looks like with the ExecutionPolicy being set to AllSigned, the powershell scripts executes just fine:
Screenshot_134.png
Screenshot_134.png (45.87 KiB) Viewed 8847 times
However, it is indeed true that if your customer have set a GPO in place that prevents unsigned scripts, then we will need to have the certificate installed on their machine.

Powershell Script Options Dialog
I am using one of the EToken dongle certificates attached to a remote CI machine, so my ability to try out solutions is a little limited. It looks like this may be related to the "Generate and install a self signed certificate" custom action, will this use the certificate provided to the installer as a whole? Do I need to specify a specific property, it defaults to AI_THUMBPRINT_PROP.
Regarding this, I'm afraid I am not that knowledgeable EToken Dongle Certificates, so we might need to contact the support team from the vendor and explain to them the situation. I'm sure they will be able to help us find a way here.

Regarding the "Install Certificate" custom actions, you can read more about it here: Install Certificate

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
swferrar
Posts: 4
Joined: Wed Jan 25, 2023 7:25 pm

Re: Code signing and powershell scripts for AllSigned group policy

Thanks, we are currently resolving this by having the user do the certificate install through windows, I'll look more into isolating that .cer file on our end to see if we can do it via that custom action.
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: Code signing and powershell scripts for AllSigned group policy

You are always welcome!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”