Thursday 28 January 2016

How to backup and Restore Permission for Site Collection

Backup and Restore Permission for Site Collection.

Hi Friends,

Recently in my office some of colleagues provided me with set of deactivated user to be removed from SharePoint.this list contains some active users too unluckily...
which i had deleted and had no idea to restore this back..

So After Searching for the solution, i got a script to luck next time in future for any such incidence.

Please download the script from here.

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 of permission restore but make you have the XML syntax correctly formed

No comments:

Post a Comment