4

I am trying to automate adding startup and shutdown scripts to Local Group Policy (gpedit.msc). One solution is to write to registry directly as pointed out in http://ccm.net/faq/3358-execute-a-script-a-startup-and-shutdown. I'm looking for a way to do it via powershell script using the GroupPolicy module. I want to know if this is possible/anyone has succeeded in doing this?

UPDATE: After reading through msdn articles, I figured out that we can access domain group policy objects but the local group policy object (which contains the startup and shutdown scripts) is stored in registry. I am trying to find a way to access and edit this local GPO through powershell.

3
  • Homework question? What's wrong with doing it by registry? What's the actual problem you are trying to solve? Jan 5, 2016 at 11:16
  • not homework. I am looking to automate it using powershell. It would be deployed with a bunch of other scripts. I'm trying to run an exe with arguments during startup and shutdown. Kindly see edit. Jan 5, 2016 at 23:15
  • 1
    What's wrong with doing it by editing the registry? That's the easy, obvious, low-hanging fruit, and it works. You can script registry editing in powershell you know. "one solution is 'X', but I want to do it a different way that I don;t know how to do..." Jan 6, 2016 at 10:47

1 Answer 1

0

If you're trying to do this on a workgroup machines, configure it manually. If they are part of a domain, do it via GPO. All the same options are avail in GPO that are avail in local policy.

enter image description here

1
  • Just an opinion so I will keep it short. I prefer always using GPOs as splitting it can lead to confusion later. It might not be possible but it's something I have found to be a best practice.
    – Nick Young
    Jan 12, 2016 at 3:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .