This project is read-only.

Project Description

These PowerShell scripts can backup and restore all your SharePoint Site Collections, Webs, Document Libraries, Folders and File.

This script does not backup permission for SPList and ListItem, It serves as a script to backup document related permission only

Backup Permission

How to use
How to run the backup script:
  1. Copy the BackupPermission.ps1 file to your SharePoint Server.
  2. Open SharePoint Management Shell via Administrator rights.
  3. Navigate to the BackupPermission.ps1 folder.
  4. Run BackupPermission.ps1 to start backing up all site collections.
  5. A Permissions.xml file will be generated in the same folder.

PowerShell Parameter:
  • -SiteUrl : Specify a URL to explicitly backup only a Site Collection
  • -Verbose : Execute in verbose mode where more information will be displayed and logged.


Restore Permission

How to run the backup script:
  1. Copy the RestorePermission.ps1 file and Permission.xml file that was generated after running BackupPermission.ps1, to the same folder in your SharePoint Server.
  2. Open SharePoint Management Shell via Administrator rights.
  3. Navigate to the RestorePermission.ps1 folder.
  4. Run RestorePermission.ps1.
  5. A list of affected Site Collection will be shown. Enter 'Y' or 'y' to continue.

PowerShell Parameter:
  • -Confirm : To bypass confirmation prompt.
  • -Verbose : Execute in verbose mode where more information will be display and logged.


Additional Configuration (script)

$global:includeFilePermission - Change this variable to $true to include File level permission and $false for otherwise.

Note: Each execution of the BackupPermission.ps1 and RestorePermission.ps1 will generate a log file in "Logs" sub-folder where the script sits.
You can modify the Permissions.xml file to change the behaviour for the permission restoration but make sure you have the XML syntax formed correctly. Refer to http://wp.ahcheng.com/2015/06/03/sharepoint-permission-back-up-and-restore-in-powershell/

Last edited May 13, 2016 at 9:08 AM by yihaa5, version 12