Create New Managed Account in SharePoint 2013 Using Powershell

Managed accounts are active directory accounts for SharePoint's whose credentials are managed by SharePoint. Managed accounts in SharePoint 2013 is explained in my another article: Configuring Managed Accounts in SharePoint 2013.
Important: Before creating a managed account, They must be already created in your Active directory.

How to create a managed account in SharePoint 2013?
To register new managed account in SharePoint 2013, here are the steps:
  1. Open SharePoint 2013 Central administration site.
  2. Go Security >> Click on Configure Managed Accounts.
  3. Click the Register Managed Account link to create a new managed account.
  4. Enter the account’s AD username in domain\username format. Specify the account's password.
  5. Optionally, You can enable the automatic password reset.
  6. Click "OK" to to create managed account in SharePoint 2013.
    create managed account sharepoint 2013 powershell
Important: To register managed account SharePoint 2013, You must be a member of Farm Administrators SharePoint group.

Create new managed account sharepoint 2013 using PowerShell
To create a managed account using PowerShell: use the New-SPManagedAccount cmdlet. Here is how:
$cred = Get-Credential
New-SPManagedAccount –Credential $cred
This prompts to enter credentials and register managed account in SharePoint 2013/2016.

Register new managed accounts SharePoint 2013 in Bulk:
Lets create multiple managed accounts in SharePoint 2013 using PowerShell:
Add-PSSnapin microsoft.sharepoint.powershell -ea SilentlyContinue

#Define a common password for all service accounts
$password = "Password1"
$securePassword = ConvertTo-SecureString -String $password -AsPlainText -Force

#List of Service accounts
$ServiceAccounts = "SP-Farm","SP_Services","SP_Search","SP_UserProfile"

   ForEach ($Account in $ServiceAccounts) 
    #Get the account in Domain\UserName format
    $userName = $env:USERDOMAIN + "\" + $Account
    #Set the Credentials
    $cred = New-Object System.Management.Automation.PSCredential -ArgumentList $username, $securePassword
    #Create Managed Account
    New-SPManagedAccount -Credential $cred
Here, I've specified a common password for all managed account. However, you  can specify different passwords for different service accounts.


While trying to add a managed account in SharePoint 2013, You may encounter below issues:

SharePoint register managed account access denied: unable to register managed account 
You may get access denied error when you try to register a managed account via Central Administration, You'll get this error: >> Security >> Configure Managed Account >> Register Managed Account.
  • Make sure either you are running SharePoint Management shell as administrator or UAC is disabled prior executing PowerShell cmdlets. 
  • Verify that your service account is allowed to change password from its properties -  “User cannot change password” !
  • if "Automatic Password reset" property is already enabled for your managed account, you may get "Access denied" error! Remove that existing account and crate a new one.
  • Use PowerShell to register new managed account!
SharePoint managed account requested registry access is not allowed:
Fix: Your Central administration App pool Identity must be a Farm Admin account also a LOCAL Administrator account

The given key was not present in the dictionary when register managed account in SharePoint 2013
Fix - KB:

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.