Forum Discussion
Powershell to Remove Additional admins on all SP sites
elaheh : Yes you can do that using PowerShell
1) First, connection to the SharePoint using Connect-SPO service.
2) Get handle of all site collections using GetSPOSite.
3) Loop through each site
4) Get all site collection admins using method Get-SPOUser and IsSiteAdmin = true.
5) Loop through each admin. (This will give you all the admins name).
6) Inside this loop, add If condition for the admin whom you don't want to remove.
7) And in Else condition write method for to remove. here you have to set IsSiteCollectionAdmin == False.
I did this code long time back, it will be somewhere in the archival, need to check for the code.
By that time, please check if you can achieve this through above guidelines.
Hope this helps !
Thanks Ashish_Kohale
I will try.