Pages

Thursday, 2 November 2017

how to add a user with full control rights on multiple SharePoint site collections from import .csv file using power shall script

Today, in this article we are going to see how to add a user with full control rights on multiple SharePoint site collections from import .csv file using power shall script

1. Adding ADFS account users to site collection

[Microsoft.SharePoint.SPSecurity]::RunWithElevatedPrivileges({
$csv=import-csv C:\SiteCollectionUrls.csv
foreach($site in $csv){Set-SPUser -Identity 'i:05.t|adfs claims|user@email.com' -Web $site.Site -AddPermissionLevel "Full Control"}
});

2. Adding windows account users to site collection

[Microsoft.SharePoint.SPSecurity]::RunWithElevatedPrivileges({
$csv=import-csv C:\ SiteCollectionUrls.csv
foreach($site in $csv){Set-SPUser -Identity ' i:0#.w|domain\userid' -Web $site.Site -AddPermissionLevel "Contribute"}

});

Hope it helps you.

No comments:

Post a Comment