Powershell - Find and delete users in SDP from specific OU in AD

Powershell - Find and delete users in SDP from specific OU in AD

Hi, 

I just wanted to give something back to the community by sharing a powershell script that solved a big issue for us.

The script finds AD-users in a specific OU and then removes them from SDP. 
This is useful if your organization moves AD-users to a specific OU when a user leaves the organization and you want the user/requester removed from SDP.

1. Copy and paste the query from the attached .txt and run it as a query report in SDP.
The query exports a list of all users in SDP so it might take som time to run.
2. Save the result as a CSV.
3. Follow all the instructions marked by # in the Powershell script. Note that you have to change parts of the script for it to work in your enivornment and that you need the AD-module installed for Powershell.

Please run the script in a test environment before using it on your production server as it actually deletes users from SDP.
The script is not written by ME and is provided as is.

                  New to ADSelfService Plus?