Comment debug PowerShell Scripts which are executed via GPO during démarrage?

Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

Comment debug PowerShell Scripts which are executed via GPO during démarrage?

Message par Clippy »

I have a Powershell Script which install and updates Software via the Windows Package Manager [Chocolatey](http://chocolatey.org).

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?
Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

Re: Comment debug PowerShell Scripts which are executed via GPO during démarrage?

Message par Clippy »

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.
Répondre

Revenir à « Active Directory & Entra »