Remove a managed account in SharePoint 2010 using Powershell


In this article we will see how to remove a managed account using powershell in SharePoint 2010.

Managed Accounts:

Managed Accounts is a new feature in SharePoint 2010. Managed accounts are Active Directory user accounts whose credentials are managed by and contained within SharePoint. When administrators configure a new web application or service application they don't have to remember the username and passwords every time if the service account is registered. They can just simply select the managed account and they can configure the web application and service application. For example when administrator create a new web application (Go to Central Administration => Application management => Manage Web Applications => Click New in the ribbon interface)

Administrator can just choose the service account (whose account is already is registered) for the application pool from the drop down as shown in the following

RemoveShare1.gif

Automatic password change:

SharePoint 2010 also introduces automatic password change.

Automatic password change enables SharePoint to automatically generate new strong passwords on a schedule you set. Select the Enable automatic password change checkbox to allow SharePoint to manage the password for the selected account.

If an account policy based expiry date is detected for the account, and the expiry will occur before the scheduled date and time, the password will be changed on a configured number of days before the expiry date at the regularly scheduled time.

We can choose to enable e-mail notifications in order to have the system generate warning notifications about upcoming password change events.

We can also specify a time and schedule for the system to automatically change the password.

Remove a Managed Account:

Go to Central Administration => Security => General Security => Configure managed accounts.

RemoveShare2.gif

You could be able to see all the managed accounts.

In this we will be seeing how to remove a managed account using powershell.

Click on Remove for the service account that has to be removed from the managed accounts.

RemoveShare3.gif

Click on Ok, so that the service account will be removed from the Managed account.

You can remove a managed account for the specified credential.
The same thing can be achieved using the following powershell cmdlet.

Remove-SPManagedAccount:

Remove-SPManagedAccount - Removes account registration from the configuration database within the farm.

Go to Start => All Programs => Microsoft SharePoint 2010 Products =>SharePoint 2010 Management Shell => Run as administrator.

Type the following command

Remove-SPManagedAccount -Identity DOMAIN\UserName

Note: For more information on Remove-SPManagedAccount cmdlet refer http://technet.microsoft.com/en-us/library/ff607697.aspx