Thursday, August 2, 2012

Powershell and Active Directory: Maintains the Leavers of your Company using powershell GUI based Application.


Like every IT Administrator we have to create user accounts when someone joined the company and also delete and reset the account when someone leaves.
From past few days i was trying to write a GUI Application based on powershell.
My Main objective was.
    • Reset Leaving Users Password.
    • Remove him from all groups.
    • Move his user account to particular OU
You can download the script form this link :

Before running this script please change this variable as per your need:  $ArchiveOu = 'OU=Archived,DC=localDC,DC=com'

Let me explain about the script.
This script is based on ActiveDirectory Module , so before running the script make sure that you have installed RSAT tools.

When you run the script first it ask for username  and password, Please provide your Domain Admin username and password.
02-08-2012 12-06-23

After you provide the credentials a GUI will open.
On the Number 1 , it is showing that if script is able to detect and imported the ActiveDirectory Module.
Our first task to to find the Users SAMAccount Name.

So provide the users First and last name (2,3) and click on Find (4)
when you click on Find .. It search for user in all AD for matching user.
in number 5 this will show the users SAMAccount Name
in Number 6 Provide a new password for user.
Now on number 7 click on Starts
When you click on start it do .
  • Reset User password
  • remove it from all Groups
  • Move it to a particular OU
02-08-2012 12-04-54

Download Link :
Thanks for reading.
Aman Dhally
Buy-More-Twitter-Followers 4fb29548b6adc  linkedin


  1. Hello, does this require third party libraries or something like that to work? I'm not sure I have access to "OnApplicationLoad".

    1. Hi Ken,

      this just require, active directory powershell module. You need to install RSAT tool on your laptop and enable Active Directory module from optional features.


  2. Hi. Is it possible to get this to disable mail account too, if the user has one?