PowerShell script with scheduled task program for Group Policy automatic backup

Source: Internet
Author: User
Also encountered a topic today, asked to automatically back up a Group Policy (GPO) every five minutes, racked their brains to find that the graphical interface does not solve the problem, so began to think PowerShell can solve, and finally really solved. Here's what I did.

First put the script:


Explain:

Import GroupPolicy This module, the method behind it

Define a time variable, and daily backups will be recorded in a folder named after the date

Specify a directory to create a new folder under the C drive

Then specify to back up all group policies to that folder

Save and run:

Successful backup, happy

The next thing is the highlight:

Open Task Scheduler and click Create Task (note Create task instead of Create basic task OH)

Name naturally needless to say

Create a new trigger and follow your own requirements to

Then click on the action (note here  ̄ω ̄=)

The program chooses PowerShell instead of the script because the PS1 script default execution is edit rather than run

parameter that is the script path

Start with the folder where the script is written

And then the rest depends on the configuration you need.

Complete

We'll start the automatic backup in five minutes, and then we'll try again.

Right-click Group Policy Objects in Group Policy Management Select Manage Backup

Then select your backup directory

This is all the backup strategy, see the time stamp on demand to restore it

Little Baikaibo, welcome comment

PowerShell script with scheduled task program for Group Policy automatic backup

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.