MSLive.fr, tout sur les derniers systèmes d'exploitation Microsoft ! Vista, Windows Server 2008...

[Système] - Le 09/04/2010, par Joachim GOMARD - Lue 833 fois

Comment sauvegarder efficacement les stratégies de groupe de votre environnement ?

Windows Server 2008 R2 intègre dorénavant un ensemble de commandes PowerShell permettant de gérer, configurer et même sauvegarder vos GPO. En effet une cmdlet appelée directement Backup-GPO permet de faire directement un export de celle-ci à l’emplacement de votre choix.

Voici le détail du Script réalisé par Tony Murray pour le plus grand plaisir des administrateurs :
#########################################################
#
# Name: BackupGPOsV2.ps1
# Author: Tony Murray
# Version: 1.0
# Date: 25/02/2010
# Comment: PowerShell 2.0 script to backup all
# GPOs within a domain
#
#########################################################
 
# Import the modules that we need
import-module activedirectory
import-module grouppolicy
# Specify the location for the backups
$BackupPath = "C:\Backup\GPO\"  
# Create the backup folder if it doesn’t exist
if(test-path -path $BackupPath)
{write-host “The folder” $BackupPath “already exists”}
else
{New-Item $BackupPath -type directory}  
# Remove any previous backups from the folder
## Note: You will need to move the backups off to tape/disk
## archive daily if you need access to older GPO versions
Remove-Item $BackupPath\* -Recurse -Force
# Find out what domain this computer is in
$mydomain = get-ADDomain -current LocalComputer
# Get all the GPOs in the specified domain
$AllDomGPOs = get-gpo -domain $mydomain.DNSRoot -all
# Loop through the array
Foreach ($GPO in $AllDomGPOs)
{
    # Backup the GPO to the specified path
    backup-GPO $GPO.DisplayName -path $BackupPath
}
#End


Url Gras Italic Souligné Foot Omg Sad Happy Money Undecided Cry Smile Shades Yell Tounge Wink

Pseudo :
 
Commentaire :