$siteUrl = "http://siteUrl" $siteCollUrl = "http://siteUrl/Reports" $web = Get-SpWeb -site $siteUrl | Where-Object {$_.Url -eq $siteCollUrl} $users = Invoke-SQL -sqlCommand "exec dbo.GetUserRightsForSP" foreach ($user in $users.Rows) { $userSp = Get-SpUser -Identity $user["SpUser"] -Web $web Set-SPUser -Identity $userSp -Web $web -Group $user["Group"] }