Forum Discussion
Bhavpreet Bains
Oct 09, 2018Iron Contributor
OneDrive list of admin
Hello,
We have a user who was accidentally added as site collection admin to various OneDrive accounts. Is it possible to pull a list of all site collection admin for all OneDrive accounts?
I've tried using the following cmdlet on one of the sites before creating the full script.
get-spouser -Site "<site url>" | select DisplayName, LoginName, UserType, IsSiteAdmin
The above returns all site users with isSiteAdmin as false unless I grant my admin account as site collection admin which is not ideal solution.
Running Get-Sposite returns only primary site collection admin.
Which should be the best way to pull list of all site collection admins?
Thank you.
B
4 Replies
Sort By
One way to do this is to get the Audit log events corresponding to the "add site collection admin" activity: https://docs.microsoft.com/en-us/office365/securitycompliance/search-the-audit-log-in-security-and-compliance#site-administration-activities
- Bhavpreet BainsIron Contributoris there a script or cmdlet that I can use?
Yes, you can use the Search-UnifiedAuditLog cmdlet: https://docs.microsoft.com/en-us/powershell/module/exchange/policy-and-compliance-audit/search-unifiedauditlog?view=exchange-ps