2

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.

  • Homework question? What's wrong with doing it by registry? What's the actual problem you are trying to solve? – BlueCompute Jan 5 '16 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. – semantic_c0d3r Jan 5 '16 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..." – BlueCompute Jan 6 '16 at 10:47
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

  • 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 '16 at 3:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.