Link to home
Start Free TrialLog in
Avatar of NetRock6
NetRock6Flag for Canada

asked on

Powershell - Setting GPO

Hi...
in powershell 5 is there a way to set grop policy to run a user logon script.
I need to setup few logon scripts for serveral PCs.
Thanks.
Avatar of J S
J S
Flag of United States of America image

Do you mean is there a method to execute a powershell script via group policy?
You don't typically use PowerShell to configure GPOs.  Use the GP Management console for that.  That's where you configure which login scripts you want to apply.

If you think about it, it makes sense.  Most scripting is about repetitive tasks.  A GPO is configured once, and then applied to many users or computers.  The GPO cmdlets are good for when you need to repeat the action, but editing a GPO for a specific setting is usually a "one and done" kind of thing.
Avatar of NetRock6

ASKER

Thanks for your comments:
Here more details about how to use Powershell: "grouppolicy" cmdlet
https://technet.microsoft.com/en-us/library/ee461027.aspx?f=255&MSPPError=-2147217396

"One thing" could be repeated over the time ...  I have never done "one thing" once.... I needed to repeat it later on too...
You can run a PS1 as a logon script or use Powershell to manage GPOs. Which one are you trying to achieve?
Managing GPO... That's why the gpo cmdlet for
Thanks
ASKER CERTIFIED SOLUTION
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
As correctly stated by footech, it is not worth it unless you have to do it very often. Whatsoever, you always start with creating the GPO manually via GUI, then export and modify the result if required.