I apologize, I am not sure how to explain this clearly.
This is for permissions on Microsoft SharePoint for a site.
This is the command I need to run OVER and OVER again, with the "120000820" to be changed.
$web = Get-SPWeb "https://DOMAINNAME/departments/SUBSITE/12000820"
function AddGroupToSite ($web, $groupName, $permLevel)
{
$account = $web.SiteGroups[$groupName]
$assignment = New-Object Microsoft.SharePoint.SPRoleAssignment($account)
$role = $web.RoleDefinitions[$permLevel]
$assignment.RoleDefinitionBindings.Add($role);
$web.RoleAssignments.Add($assignment)
}
AddGroupToSite -web $web -groupName "Limited Access - HRBP J3K" -permLevel "HRB34P"
I have all these sites I need to have the PowerShell script to go through. I then need to put the function (from the script above) below each line to update permissions.
$web = Get-SPWeb "https://DOMAINNAME/departments/SUBSITE/10300820"
$web = Get-SPWeb "https://DOMAINNAME/departments/SUBSITE/10300821"
$web = Get-SPWeb "https://DOMAINNAME/departments/SUBSITE/10300822"
$web = Get-SPWeb "https://DOMAINNAME/departments/SUBSITE/10030824"
$web = Get-SPWeb "https://DOMAINNAME/departments/SUBSITE/10030831"
$web = Get-SPWeb "https://DOMAINNAME/departments/SUBSITE/10300834"
$web = Get-SPWeb "https://DOMAINNAME/departments/SUBSITE/10030843"
$web = Get-SPWeb "https://DOMAINNAME/departments/SUBSITE/10030844"
$web = Get-SPWeb "https://DOMAINNAME/departments/SUBSITE/10030845"
$web = Get-SPWeb "https://DOMAINNAME/departments/SUBSITE/10030847"
$web = Get-SPWeb "https://DOMAINNAME/departments/SUBSITE/10030850"
$web = Get-SPWeb "https://DOMAINNAME/departments/SUBSITE/10030852"
For me, I believe that I can have the number's set as variable in a CSV or XML to pull from possibly or I can keep the above like it; etc.
I have gone into notepad and copied the line
$web = Get-SPWeb "https://DOMAINNAME/departments/SUBSITE/10300822"
and pasted in the function below it. So I'd do that over and OVER again! 100's of times, getting the next /10300822 from the list, going down the list (the number's aren't in succession).
function AddGroupToSite ($web, $groupName, $permLevel)
{
$account = $web.SiteGroups[$groupName]
$assignment = New-Object Microsoft.SharePoint.SPRoleAssignment($account)
$role = $web.RoleDefinitions[$permLevel]
$assignment.RoleDefinitionBindings.Add($role);
$web.RoleAssignments.Add($assignment)
}
AddGroupToSite -web $web -groupName "Limited Access - HRBP J3K" -permLevel "HRB34P"
Thank you. I apologize that I am not clear on this. PowerShell is not my strongsuit.
Matt