Analyze Tool - AuthorizationManager check failed

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
TCCDesktopOps
Posts: 15
Last visit: Sun May 23, 2021 6:51 pm

Analyze Tool - AuthorizationManager check failed

Post by TCCDesktopOps »

To help you better we need some information from you.

*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***

Product, version and build:PrimalScript 2020 v7.7.144.0, Primalscript is 64 bit ( couldn’t find this anywhere, but it is in “c:\program files” )
Operating system:Windows 10 64 bit version
PowerShell version(s):
PSVersion 5.1.17763.1490
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.1490
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

*****************************************************************************************************************
When clicking the “Analyze” button, I get the following in Tool output.
Starting Script Analyzer...
The following error occurred while loading the extended type data file:
Microsoft.PowerShell, C:\Program Files\WindowsPowerShell\Modules\PSScriptAnalyzer\1.19.1\ScriptAnalyzer.types.ps1xml: The file was skipped because of the following validation exception: AuthorizationManager check failed..
1 error(s), 0 warning(s)



I have never used the Analyze tool before, so I am unsure if it has ever worked.

****************************
The following may be related or may be a totally separate issue. just adding here in case relevant.
I have autosign enabled as our policy is “AllSigned”. When saving files, I get the following message, not sure if it is related or a separate issue.
“PrimalScript - The specified file could not be signed. Error: ASN1 bad tag value met.”

I have checked my cert and it looks ok, doesn’t expire for a couple of years yet.
I run Primalscript as my admin account (run as while logged in as my standard account)
Signing has worked OK for the past few years, this only started erroring a couple of weeks ago. I recreated my user profile to see if that helped, but it didn’t.

User avatar
Alexander Riedel
Posts: 7696
Last visit: Sat Jun 12, 2021 2:37 pm
Answers: 4
Been upvoted: 10 times

Re: Analyze Tool - AuthorizationManager check failed

Post by Alexander Riedel »

PSScriptAnalyzer is a tool supplied with PowerShell by default. PrimalScript simply makes it easier to call.
A quick google search reveals that the error message is common, regardless if script execution policy, if something went wrong in the authenticode system.
The first thing to try would be if you can run PSScriptanalyzer from a console. If you have problems with it, the module lives here: https://github.com/PowerShell/PSScriptAnalyzer

I have seen the ASN1 bad tag value before. It usually does not mean that there is anything wrong with your certificate. Please try to select a different time stamp server from the combobox
and see if that helps the issue.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
TCCDesktopOps
Posts: 15
Last visit: Sun May 23, 2021 6:51 pm

Re: Analyze Tool - AuthorizationManager check failed

Post by TCCDesktopOps »

perfect, thankyou, got me going in the right direction and now have fixed both my issues.

for anyone else curious about the script analyzer.

Note the following did NOT work in an elevated powershell shell using runas with my corporate admin account, I had to actually log into the PC as admin, then open an elevated PS Shell.

from here - https://chocolatey.org/install, ran this command.
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

then ran "choco install psscriptanalyzer" to install psscriptanalyzery

Once that is done, you can go back to being logged in with your normal account and as long as you run Primalscript with your admin account, it should work. I tested with my normal user account and got the same AuthorizationManager error as before.

User avatar
Alexander Riedel
Posts: 7696
Last visit: Sat Jun 12, 2021 2:37 pm
Answers: 4
Been upvoted: 10 times

Re: Analyze Tool - AuthorizationManager check failed

Post by Alexander Riedel »

Good to hear. Thanks for the detailed instructions.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
TCCDesktopOps
Posts: 15
Last visit: Sun May 23, 2021 6:51 pm

Re: Analyze Tool - AuthorizationManager check failed

Post by TCCDesktopOps »

bit more info for anyone who finds this. I found the issue reoccurred and the procedure that fixed it the first time didn't work again.
This time the following got it back (from https://www.interfacett.com/videos/use- ... lean-code/)

Get-Module -ListAvailable

# To find or install the PSScriptAnalyzer from the PSGallery, you need
# to install NuGET.
Install-PackageProvider –Name Nuget -Force

# Find the PSScriptAnalyzer module.
Find-Module -Name "PSScriptAnalyzer"

# Install the PSScriptAnalyzer module.
Install-Module -Name "PSScriptAnalyzer" -Force

# List the cmdlets in the PSScriptAnalyzer module. - this just shows that the cmdlets are available again.
Get-Command -Module PSScriptAnalyzer