-
-
Save msidmvp/80437cf6136784cfb5e276e38b9cc455 to your computer and use it in GitHub Desktop.
MIM: How To Check Pending Deletes Before Performing An Export
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##################################################################################################### | |
# Simple PowerShell script to prevent running an export if more than 1000 objects are pending delete | |
# | |
# More information on FIM and MIM WMI: | |
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms697764(v=vs.100).aspx | |
# | |
$miisWmiObject = get-WMIObject –class MIIS_ManagementAgent –namespace root/MicrosoftIdentityIntegrationServer –filter "Name='ADMA'" | |
$exportdeletes = $miiswmiobject.NumExportDelete().returnvalue | |
if ($exportdeletes > 1000) | |
{ | |
# Do not run AD Export | |
Send-MailMessage -From "IDM Alert <alert@your_email_domain.com>" -To "IDM Team <idmteam@your_email_domain.com>" -Subject "AD deletes queued" -Body "More than 1000 deletes are queued for ADMA" -smtpserver mail.your_email_domain.com | |
} | |
else | |
{ | |
Run-MA -maName "ADMA" -runProfile "Export" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment