PowerShell script to delete all site collection admins and make one collection admin

%3CLINGO-SUB%20id%3D%22lingo-sub-2070519%22%20slang%3D%22en-US%22%3EPowerShell%20script%20to%20delete%20all%20site%20collection%20admins%20and%20make%20one%20collection%20admin%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2070519%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20currently%20trying%20to%20disable%20a%20OneDrive%20for%20my%20organisation.%20It%20works%20pretty%20well%20for%20new%20users%2C%20but%20old%20ones%20got%20access.%20I%20worked%20out%20one%20solution%20-%20when%20I%20take%20away%20collection%20admin%20rights%20user%20cannot%20use%20OneDrive%20anymore.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20I%20have%201000%20users%2C%20and%20I%20will%20die%20changing%20permissions%20by%20hand%2C%20therefore%20is%20there%20any%20script%20to%20set%20all%20site%20collection%20admins%20to%20one%20person%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20mean%20those%20settings%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22F0RCE_0-1610971356931.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F247223i858C71EBD5D1116A%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22F0RCE_0-1610971356931.png%22%20alt%3D%22F0RCE_0-1610971356931.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2070519%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Contributor

Hello,

 

I am currently trying to disable a OneDrive for my organisation. It works pretty well for new users, but old ones got access. I worked out one solution - when I take away collection admin rights user cannot use OneDrive anymore.

 

But I have 1000 users, and I will die changing permissions by hand, therefore is there any script to set all site collection admins to one person?

 

I mean those settings:

 

F0RCE_0-1610971356931.png

 

0 Replies