Forum Discussion
Creating script to export reports on users and their OneDrive for external sharing
Greetings,
I was wondering if anyone has an idea of how to make a script that allows me to see who are the members in an Azure AD Security Group and see if they have External Sharing Capabilities enabled or not.
So far I have this snippet that returns list of users in a designated security group:
Get-AzureADGroupMember -ObjectId "<Security Group ObjectId>"
Note: You have to run
Connect-AzureAD
before running the "Get-AzureADGroupMember" command.
But it doesn't tell me the sharing options for those users.
However, if I use this snippet...it returns all of the OneDrive in the tenant with owner and sharing capabilities. The thing is, I don't want to see all of them, just the ones that I move to the security group in AD.
Get-SPOSite -IncludePersonalSite $true -Limit all -Filter "Url -like '-my.sharepoint.com/personal/'" | select Owner, Url, SharingCapability
NOTE: Run
Connect-SPOService -url <a href="<a href="https://domain-admin.sharepoint.com" target="_blank">https://domain-admin.sharepoint.com</a>" target="_blank"><a href="https://domain-admin.sharepoint.com</a" target="_blank">https://domain-admin.sharepoint.com</a</a>>
before the "Get-SPOSite" command.
What I want at the end of it all is to have a list of users that are inside the security group and tell if they have external sharing capabilities or not.