How can I use PowerShell to update a GPO for a scheduled task on workstations?

0
24
Asked By TechyNinja42 On

I'm looking for advice on managing a Group Policy Object (GPO) that creates a scheduled task on workstations. The task checks the version number of a specific software and performs actions if the version is outdated. Currently, I manually edit this GPO in the Group Policy Management Console about once a year to update the version number in the scheduled task XML.

Ideally, I'd like to automate this process with a PowerShell script that takes the version number as a parameter and updates the GPO with the new version information for the scheduled task's file comparison action. I've tried a few methods but haven't had any success yet, so any guidance would be much appreciated!

5 Answers

Answered By CodeCracker77 On

If you're trying to automate the GPO edits, I suggest embedding the whole scheduled task XML into your PowerShell script using a "here-string" with parameterized values. After a simple parameter change, it’s quick to execute without diving into the GPO editor.

Answered By ScriptWizard99 On

You might want to consider storing the script on your netlogon share and have the scheduled task call it directly. It’ll make it easier to update the script rather than modifying the GPO each time. This way, all you need to do is change the script when necessary, rather than the GPO itself.

Answered By GPOGuru22 On

I think you're overcomplicating it a bit. If it's just a 5-minute yearly task, is full automation really worth it? However, if you really want to edit the GPO directly, you could directly modify the XML file in the GPO folder structure using PowerShell. Just be cautious with direct editing.

Answered By HelpMePlease01 On

How are you currently setting the version number? You could simplify this by using a file that holds the version number, which your script reads from when it runs. This would let you update the version easily without needing to go into the GPO.

Answered By DebuggingDiva On

Since you're dealing with proprietary GPExtensions for the software, I understand why GPO deployment is tricky. But have you considered if the software itself could be made more GPO-friendly? It might save you a lot of headaches in the long run.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.