56 lines
1.3 KiB
Markdown
56 lines
1.3 KiB
Markdown
![]() |
Auslesen Bebutzer Rechte auf Site Collection
|
|||
|
|
|||
|
Mittwoch, 5. April 2017
|
|||
|
|
|||
|
12:18
|
|||
|
|
|||
|
|
|||
|
|
|||
|
param(\$Site = \"\<Name der Site Collection\>\")
|
|||
|
|
|||
|
|
|||
|
|
|||
|
if((Get-PSSnapin -Name \"Microsoft.SharePoint.PowerShell\" -EA 0) -eq \$null)
|
|||
|
|
|||
|
{
|
|||
|
|
|||
|
Add-PSSnapin \"Microsoft.SharePoint.PowerShell\"
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#Auslesen aller Benutzer mit Detailinformationen wie Gruppen, Rollen, etc. innerhalb der aktuellen Site Collection Url.
|
|||
|
|
|||
|
\$users = Get-SPUser -Web \$Site -ErrorAction Stop \| select UserLogin, DisplayName, \@{Label=\"ExplicitGivenRoles\";expression={\$\_.Roles}}, \@{Label=\"RolesGivenViaGroups\";expression={\$\_.Groups \| %{\$\_.Roles}}}, Groups
|
|||
|
|
|||
|
|
|||
|
|
|||
|
\$users \| foreach{
|
|||
|
|
|||
|
\$strGroups = \"\"
|
|||
|
|
|||
|
\$strGroupWithoutPraefix = \"\"
|
|||
|
|
|||
|
\$\_.Groups \| foreach{\$strGroups += \"\$\_, \"}
|
|||
|
|
|||
|
if(\$strGroups -ne \"\")
|
|||
|
|
|||
|
{\$strGroupWithoutPraefix = \$strGroups.Substring(0,\$strGroups.Length-2)}
|
|||
|
|
|||
|
\$object = New-Object PSObject
|
|||
|
|
|||
|
\$object \| add-member noteproperty -name \"UserLogin\" -value \$\_.UserLogin
|
|||
|
|
|||
|
\$object \| add-member noteproperty -name \"DisplayName\" -value \$\_.DisplayName
|
|||
|
|
|||
|
\$object \| add-member noteproperty -name \"ExplicitRoles\" -value \$\_.ExplicitGivenRoles
|
|||
|
|
|||
|
\$object \| add-member noteproperty -name \"GroupRoles\" -value \$\_.RolesGivenViaGroups
|
|||
|
|
|||
|
\$object \| add-member noteproperty -name \"SPGroup\" -value \$strGroupWithoutPraefix
|
|||
|
|
|||
|
\$object
|
|||
|
|
|||
|
}
|