SOLVED

Running a powershell script through a live response session

%3CLINGO-SUB%20id%3D%22%5C%26quot%3Blingo-sub-3168497%5C%26quot%3B%22%20slang%3D%22%5C%26quot%3Ben-US%5C%26quot%3B%22%3ERunning%20a%20powershell%20script%20through%20a%20live%20response%20session%26lt%3B%5C%2Flingo-sub%26gt%3B%3CLINGO-BODY%20id%3D%22%5C%26quot%3Blingo-body-3168497%5C%26quot%3B%22%20slang%3D%22%5C%26quot%3Ben-US%5C%26quot%3B%22%3E%3CP%3EI%20have%20a%20powershell%20script%2C%20which%20has%20been%20digitally%20signed%20and%20uploaded%20to%20the%20files%20repository%20for%20usage%20within%20a%20365%20Defender%20Live%20Response%20Session.%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EThe%20powershell%20script%20just%20runs%20these%20three%20commands%3A%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EGet-MpComputerStatus%3CBR%20%2F%3EGet-MpThreat%3CBR%20%2F%3EGet-MpPreference%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EI%20can%20run%20the%20script%20with%20no%20issues%20from%20my%20local%20machine%20as%20a%20regular%20user%20with%20no%20elevated%20privs.%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EIf%20I%20initiate%20a%20Live%20Response%20session%20and%20run%20the%20file%20on%20the%20device%2C%20I%20receive%20the%20following%3A%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EErrors%3A%3CBR%20%2F%3E.%20%3A%20AuthorizationManager%20check%20failed.%3CBR%20%2F%3EAt%20line%3A1%20char%3A818%3CBR%20%2F%3E%2B%20...%2027%7D.txt'%3B%20.%20'C%3A%5C%5CProgramData%5C%5CMicrosoft%5C%5CWindows%20Defender%20Advanced%20Threa%20...%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20SecurityError%3A%20(%3A)%20%5B%5D%2C%20PSSecurityException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20UnauthorizedAccess%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EYou%20would%20think%20that%20owning%20the%20Security%20Administrator%20Role%20would%20permit%20running%20the%20script%3F%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EAny%20clues%20would%20be%20greatly%20appreciated.%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EMany%20thanks%26lt%3B%5C%2FP%26gt%3B%26lt%3B%5C%2Flingo-body%26gt%3B%3CLINGO-LABS%20id%3D%22%5C%26quot%3Blingo-labs-3168497%5C%26quot%3B%22%20slang%3D%22%5C%26quot%3Ben-US%5C%26quot%3B%22%3E%3CLINGO-LABEL%3EIncident%20Management%26lt%3B%5C%2Flingo-label%26gt%3B%3CLINGO-LABEL%3EInvestigation%26lt%3B%5C%2Flingo-label%26gt%3B%3CLINGO-LABEL%3EMicrosoft%20Defender%20for%20Office%20365%26lt%3B%5C%2Flingo-label%26gt%3B%26lt%3B%5C%2Flingo-labs%26gt%3B%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3C%2FLINGO-SUB%3E
Contributor

I have a powershell script, which has been digitally signed and uploaded to the files repository for usage within a 365 Defender Live Response Session.

The powershell script just runs these three commands:

Get-MpComputerStatus
Get-MpThreat
Get-MpPreference

I can run the script with no issues from my local machine as a regular user with no elevated privs.

 

If I initiate a Live Response session and run the file on the device, I receive the following:

 

Errors:
. : AuthorizationManager check failed.
At line:1 char:818
+ ... 27}.txt'; . 'C:\ProgramData\Microsoft\Windows Defender Advanced Threa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess

 

You would think that owning the Security Administrator Role would permit running the script?

Any clues would be greatly appreciated.

Many thanks

12 Replies
I've just found this, which may be the answer:
The AuthorizationManager check failed error can be thrown when importing modules or running scripts that were downloaded from the internet on Windows. You can use the Unblock-File cmdlet to ensure that the file can be run.
Commands are really limited during that session so don't think unlock command will work. Because it's been digitally signed, it should be trusted therefore renders that moot
Is the certificate of authority used for the digital signing trusted on the device in question?
I'm facing exactly the same issue, and yet to find the solution. signed script works perfectly when run locally, however running the same script on the same machine via live response. fails with the same error - "AuthorizationManager check failed"
Hey @Jonhed
Thanks for responding. Yes, the server that signed is the domain certserv - loved by all!! :rolling_on_the_floor_laughing:
Hi @af-00001
Ok, well at least that’s two of us in the same boat! I haven’t found a solution yet, which is really annoying - you’d think if can run via a non-admin user, it should be able to run via the trusted connection. I hope someone from MS eventually see’s this and can offer some help\wisdom
On monday I’m going to see if I can permit the file through 365 Defender
best response confirmed by CodnChips (Contributor)
Solution

I had the exact same issue. I had my code signing certificate installed in the current user's "Trusted Publishers" so I could both sign my script and run my script in Powershell. But when I tried to run the script in Live Response, it gave me the "AuthorizationManager check failed" error.

The code signing certificate needs to be installed into Local Computer/Trusted Publishers. Live Response shell runs as SYSTEM, and it needs to see your code signing certificate in order to trust the Powershell script. I'm still testing, but it sounds like you need to push out your code signing certificate to Local Computer/Trusted Publishers for your entire fleet. (Make sure when you export your code signing certificate to NOT include your private key, otherwise your certificate could be used by others to sign code)

I assumed that getting a code signing certificate from a trusted CA meant I wouldn't have to install my certificate on all computers but that doesn't appear to be the case.

@TheDilly Thanks ill check that. However the signing cert I have used if a fully correct suburbanite CA from the domain PKI.  So should already be fully trusted on all machines in the domain

Mine is too. I assumed that since all the computers in the domain trust the CA I got the code signing certificate from, everyone would trust my certificate. But that doesn't appear to be the case.

The Scripting Guy lays out the step by step when using an internal PKI:
https://devblogs.microsoft.com/scripting/hey-scripting-guy-how-can-i-sign-windows-powershell-scripts...
https://devblogs.microsoft.com/scripting/hey-scripting-guy-how-can-i-sign-windows-powershell-scripts...

And I also reached out to Microsoft Support about the "AuthorizationManager check failed" and they told me to put the certificate in the Trusted Publisher store for the Local Machine. It did solve the problem.

So why use a trusted CA if we have to distribute the certificate anyway?
Thank you!

That solved it for me as well. signing cert needs to be imported directly into trusted publishers.
@TheDilly
Thanks so much for your response - this is THE answer! I've tested this today on a single machine and BAM it worked straight away!! This makes forums amazing!
This info & the error displayed should be included in the MS Docus for Defender Live Response.
Thanks again