Purging (Deleting) Inactive Student Network and Email Accounts

Problem Description : 

Process to run quarterly to remove inactive student network/email accounts.

 

 

 Resolution : 

 

All SQL Scripts are located in "n:\csd\tracy\sql\csd sqls\active directory admin scripts". All batch files, mail merge files, data files etc. are located in N:\csd\Troy\delete_student_accounts. Folders are created for each term the purge is conducted and needed files are copied from previous folder into new folder in order to separate.

 

The purge process takes 2 phases.

Phase 1 - Text files for doing email merge warnings are generated and MS Word is used to email the student accounts.

Phase 2 - A SED script file to remove any recent applicants or enrolled students from the del_stdt.txt file is created and the delete process is ran.

 

Phase 1 Steps:

1 - Under N:\csd\Troy\delete_student_accounts\ create a new folder for the current term and copy del_filemake.bat, update_list.bat and warning_email.docx from a previous purge folder.

2 - Under n:\csd\tracy\sql\csd sqls\active directory admin scripts\ edit the SQL file named del_stdt_3yr.sql*. Update the term in the WHERE clause to the earliest graduation term to NOT purge**. Location for edit has a comment.

2 - Run batch file del_filemake.bat under N:\csd\Troy\delete_student_accounts\<<TERM>> to create del_std.txt

3 - Open MS Word document warning_email.docx and make any needed edits. Email merge with the del_stdt.txt file.

 

Phase 2 Steps:

1 - Run update_list.bat under N:\csd\Troy\delete_student_accounts\<<TERM>> to create sed file that will remove students from del_stdt.txt that now have an application or have registered for current/future terms (creates new final_stdt.txt).

2 - Copy final_stdt.txt to \\mbx1\c$\batch. Can rename for term identification (ex. del_stdt_201408.txt).

3 - Modify batch_delete_stdt.bat on MBX1 so that text file name matches with purge file. Two places - file argument being passed to ps1 file and the file argument in the for loop.

4 - Run batch_delete_stdt.bat from MBX1 (see 500 limit Threshold notes below**)

5 - Deleted users should show under 'Deleted Users' in Office 365 Admin Center following a directory sync (every 30 minutes) under Users > Deleted users for 30 days. After 30 days the account is purged forever.

6. Open n:\csd\tracy\sql\csd sqls\active directory admin scripts\del_stdt_3yr.sql. Highlight delete part of the script and run in Toad in order to remove these student emails from GOREMAL.

 

** ADSync Export Deletion Threshold

 

Must be run in Powershell (not Windows Azure Active Directory Module) - Run on the ADConnect Server (CIPHER2)

 

If deleting more than 500 users see https://azure.microsoft.com/en-us/documentation/articles/active-directory-aadconnectsync-feature-prevent-accidental-deletes/

 

c:\> Connect-MSOLService 

 

Login as Global Admin for Office 365

 

c:\> Get-ADSyncExportDeletionThreshold 

 

Will show the status of threshold

 

c:\> Disable-ADSyncExportDeletionThreshold

 

This will temporarily disable the 500 user limit.

 

To re-enable the protection, run the PowerShell cmdlet: 

 

c:\> Enable-ADSyncExportDeletionThreshold -DeletionThreshold 500. 

 

 

* Conditions have changed from semester to semester - verify with Business Office

 

** have been subtracting 3 years from current term to determine earliest graduation term to NOT purge.

cur_term --> gr_term

XXXX08 --> (XXXX-3)08

 

 

 

       

 

 

 

 

 Revision Date : 11/27/2019