PowerShell / GPO

scott jackowski 0 Reputation points
2023-05-09T14:23:20.95+00:00

I am attempting to run a PowwerShell script through Group Policy without success, I believe the issue my be that the script is not allowed to run freely on the PC's, I think I need to change the execution policy? I am running the following in the 'script Parameters' option

Powershell -ExecutionPolicy "bypass" -NoProfile -Command "\PATH TO PS1 FILE"

This is a script that will collect a detailed inentory of each PC at logon.

As of right now It will run successfully if I manually run it from a PC after PS prompts me to select 'R' to run once, But I have to right click on the file and run in powershell, if I simply double-click the file it will open in notepad.

I am fairly new to this process so any assistance would be appreciated. Thanks.

PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
731 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 26,416 Reputation points
    2023-05-10T11:01:16.94+00:00

    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--

    0 comments No comments