Hello
Thank you for your question and reaching out.
Go to GPO -> Computer Configuration section -> Administrative Templates -> Windows Components -> Windows PowerShell -> Select Allow all scripts
To run Powershell scripts using Group Policy, use the Powershell Scripts tab of the Group Policy Startup Scripts Properties page.
You can verify that the user logon script was executed successfully by the Event ID 5018u nder Microsoft-Windows-GroupPolicy/Operational section of Event Viewer.
--If the reply is helpful, please Upvote and Accept as answer--