You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to get SharePoint Online site owners for service desk team. Looking for community to review the script and provide recommendation/suggestions.
I am not sure if Get-PnPAzureADGroupMember is recursive i.e. it gets user in nested groups. If not what I can do to get users from nested groups.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am trying to get SharePoint Online site owners for service desk team. Looking for community to review the script and provide recommendation/suggestions.
I am not sure if Get-PnPAzureADGroupMember is recursive i.e. it gets user in nested groups. If not what I can do to get users from nested groups.
Function Get-SiteConnection { Param( [Parameter(Mandatory = $true, Position = 0)] [string]$Url ) $ClientID = "<MyClientID>" $CertPath = "<CertPath>" $CertPass = "<CertPassword>" $Password = (ConvertTo-SecureString -AsPlainText $CertPass -Force) $AadDomain = "<My AadDomain>" Connect-PnPOnline -Url $Url -ClientId $ClientID -CertificatePath $CertPath -CertificatePassword $Password -Tenant $AadDomain }
`Function Get-SPUsers
{
Param(
[Parameter(Mandatory = $true, Position = 0)]
$Members
)
$Emails = @()
Foreach ($Member in $Members)
{
}`
`Function Get-SiteOwners {
Param(
[Parameter(Mandatory = $false, Position = 0)]
$IsSubsite = $false
)
$Users = @()
}`
Function Add-SiteOwnerListItem { Param($Title,$Url,$IsSubsite,$Owners) Get-SiteConnection -Url '<MySite>' $list = 'SiteOwners' Add-PnPListItem -List $list -Values @{"Title"=$Title;"SubSite"=$IsSubsite;"SiteUrl"="$Url, $Url";"SiteOwners"=$Owners} Disconnect-PnPOnline }
`$filterUsers =
$Sites =
Foreach ($Site in $Sites) {
Get-SiteConnection -Url $Site.Url
Write-Host "Processing Site:$($Site.Url)"
$Owners = Get-SiteOwners -IsSubSite $Site.IsSubSite
Disconnect-PnPOnline
}
}`
Beta Was this translation helpful? Give feedback.
All reactions