Forum Discussion
Patrick Rote
Apr 29, 2021Iron Contributor
List all guest users in tenant based on site collection
Hi All,
I would like to export a list of guest users in our tenancy but i need to scope it to some specific site collections. Don't want all the site collections in the tenancy
I know i can use the below to get all users
Get-AzureADUser -All $true -Filter "UserType -eq 'Guest'"
and the below to get specific site collections
#Get All Site Collections starting with url starting with ABC
$SiteCollectionsURL = "/ABC"
$GetTenantSite = Get-PnPTenantSite -Filter "Url -like $SiteCollectionsURL" -Detailed | Select-Object Title, URL, Created, Status, Owner, LastContentModifiedDate, WebsCount, Template, StorageUsage
What do i need to do to combine the two to get the site collections and then the guest users in those site collections?
Am i in the right directions?
Thanks in Advance
No RepliesBe the first to reply