Forum Discussion

수현 김's avatar
수현 김
Copper Contributor
Sep 27, 2017
Solved

Deleting Organization on SDS

Hello. I want to delete Organization(School) on SDS. (https://sds.microsoft.com) How can I delete Organization? Thank you.    
  • Marko Franken's avatar
    Oct 04, 2017

    Hello.

    Yes, you can.

    Take a look at Bill Sluss's SDS Scripts here: https://github.com/OfficeDev/O365-EDU-Tools/tree/master/SDS%20Scripts

     

    As schools are AdministrativeUnits (AUs) in Azure AD (AAD), you must use AAD's AU commands to do the job.

     

    This script https://github.com/OfficeDev/O365-EDU-Tools/blob/master/SDS%20Scripts/Remove-All_Schools.ps1 has a perfect example, what steps are needed to gather the AUs. (I love the part, where those scripts actually check for and install if needed the required Powershell and MSOL Sign-In Assistant...)

     

    Quick fix would be to comment the line 228 from:

    Remove-MsolAdministrativeUnit -ObjectId $au.ObjectId -Force 

    to

    #Remove-MsolAdministrativeUnit -ObjectId $au.ObjectId -Force 

    Just to be sure nothing can be deleted.

     

    Now its perfectly safe to run the script in Powershell ISE, (set a breakpoint at line 227)

     

    .\Remove-All_Schools.ps1 -RemoveSchoolAus $true 

     

    run to the point where it will ask you about deleting the schools really, here you can answer yes (as we disabled the actual delete-functionality with the # in front of line 228), let the program run until breakpoint at line 227 and then examine the resulting csv file made. (name and path are on-screen)

    It will contain the needed ObjectIDs for the school AUs.

     

    With that info you can actually delete the AU you want like this:

     

    Remove-MsolAdministrativeUnit -ObjectId  1dc48982-fdac-4bd5-b21a-d8997ed11111 -Force

     

    Then check the school is deleted.

     

    PS. Kudos to

    Written by: SDS Team, and adapted by Bill Sluss

     

    Regards

    Marko

     

Resources