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

769 views Asked by At

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.

1

There are 1 answers

0
TobiasH On

I would recommend using Event Viewer to check the group policy logs. Applications and Services Logs/Microsoft/Windows/GroupPolicy/Operational These logs are also replicated under Applications in Event Viewer, along with other logs could be of interest.

You should also check Windows Logs/System.

  1. Are you able to find any logs regarding the GPO you are trying to apply?

Applying Group Policy troubleshooting guidance https://learn.microsoft.com/en-us/troubleshoot/windows-server/group-policy/applying-group-policy-troubleshooting-guidance

  1. Are you able to navigate to the netlogon location trough an elevated command prompt and run the script manually?