Windows – How to debug PowerShell Scripts which are executed via GPO during startup

active-directorygroup-policypowershellwindows

I have a Powershell Script which install and updates Software via the Windows Package Manager Chocolatey.

If I execute my PS-Script as a user, everything is fine. So there has to be another issue like an restricting Execution Policy (this is set to unrestricted via GPO).

How do I get the Output of the Powershell? I am using Start-Transcript but I cannot find the output file anywhere and if I specify the path it doesn't create the log file…

The Powershell-Script executes during startup as machine GPO.

Are there other options to debug, I havent thought of?

Best Answer

Problem was very stupid... I had added the Powershell Script in the Scripts Section not in the Powershell Scripts Section while in the Properties of Startup-Scripts...

I found out, that Start-Transcript does not create a logfile when executed as SYSTEM-Account (during Startup). You have to specify a path, then it creates the logfile. Sorry and thank you for your help.