2023-03-22

User Logon scripts in PowerShell doesn't work on Windows Server older than 2019

I've created a simple PowerShell script which writes a few text data into CSV file every time when the user logon and logoff to the servers (based on Windows Server 2008, 2012, 2016 and 2019). E.g. Get-Date | Export-CSV -Path \\server.domain.local\Folder\file.csv.
It has been set to the User Configuration GPO Policy for Logon and Logoff PowerShell scripts. Scripts were placed on the SYSVOL (Policy folder) and for test as well on the NETLOGON folder (GPO's placed there use PowerShell Bypass policy by default). Authenticated Users have Read and Read& Execute permissions on the SYSVOL/NETLOGON folders where the scrips are located and on the scripts itself same permissions exists. Authenticated Users have the write permissions on the target CSV file and folder. When standard, administrator and domain admin users logs in to the Windows Server 2019 both Logon and Logoff scripts works well and writes the data into the CSV file. For Windows Server 2008 R2, 2012 R2 and 2016 it doesn't work. Any ideas what the issue could be?

I've added Policy Bypass in the PowerShell scripts directly - but that haven't change anything. I've added Policy Bypass as PowerShell script in GPO policy as a execution parameter but still no change. No error messages in the servers or DC's event logs. Scripts have not been digitally signed yet to not complicated the situation.



No comments:

Post a Comment