Skip to content

Create A MSA Group Using PowerShell - Server 2012

Technical Article

How to create a group Managed Service Account on Windows Server 2012 with PowerShell, including the KDS root key the domain needs first.

Categories
MicrosoftWindows Server 2012
Tags
Microsoft Service AccountMicrosoft Sql ServerMsaServer 2012
Create A MSA Group Using PowerShell - Server 2012

For those who are struggling to create service accounts:

Open PowerShell

Import-Module Activedirectory

Create the Service Account:

New-ADServiceAccount -name <Service Account Name> -Enabled $true -DNSHostName <Service Account Name>.domain.com -PrincipalsAllowedToRetrieveManagedPassword "<Group or Computer>"

Example:

New-ADServiceAccount -name MSA1 -Enabled $true -DNSHostName MSA1.domain.com -PrincipalsAllowedToRetrieveManagedPassword "Sql Server Group"

Add computer to service account:

Add-ADComputerServiceAccount -Identity <Servername> -ServiceAccount <Service Account Name>$

Example:

Add-ADComputerServiceAccount -Identity SQL1 -ServiceAccount MSA1$

Install Service Account:

Install-ADServiceAccount -Identity <Service Account Name>$

Example:

Install-ADServiceAccount -Identity MSA1$

To test to see if this has worked:

Test-ADServiceAccount -Identity <Service Account Name>$

Example:

Test-ADServiceAccount -Identity MSA1$