Granting permissions on SharePoint objects

Today I am providing the Power Shell Script that give permissions on Item level to the users or groups that are provided in a csv file. This csv will take the csv file as input. The structure of csv file will contain following columns - WebsiteURL,Libraryinternalname,Itemname,user_group,permissions,type,removeexistingpermission
Here in type you have provide the type of the object - Site, Library, Folder, Item
and In removeexistingpermission you have provide if you want to remove existing permissions in the form of True/False.
Sample file is also provided in the blog. Provide items and their permission individually in the csv.

Update - For the items  or folder that are under some folder structure, provide complete structure like "rootfolder1/subfolder2/subfolder3/item.ext". You can provide multiple user/group names and multiple permissions for the same item in one row separated by a comma. Create csv file using Ms Excel else you have to put "" for providing multiple user names and permissions like "user1,user2","permission1,permission2". All the permissions will be granted to both the all the users in one row on the given Item. if you want to give different permissions for different users then add them in different rows.

You can provide different sites, different libraries in one go to provide the permissions to their items in one go.

This script will take path of csv file as input. Further this csv file will be used as input.


This script will give the permission to the users  on the items  



.\scriptname.ps1 | out-file “FilePath\Filename.txt”

Dependencies -
Input CSV file must be ready for the script.

Item names should be provided with extension. For folder names leave extensions.

Permission levels/Groups/Users must be available in sharepoint.

For executing this script user must be added in site collection administrators given site.

User should have Shell Admin rights to run the scripts.
Run Management Shell as an Administrator.
How to execute -
Copy this script and paste in Note pad.
Save this file as .ps1.
Run this script in SharePoint Management Shell. You can run this script in PowerShell as well.
Follow on screen instructions.


To see and download csv template file click here.

Go to above link to get the script.