PowerShell Logo Small

Install-ADServiceAccount



This is the built-in help made by Microsoft for the command 'Install-ADServiceAccount', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Installs an Active Directory managed service account on a computer or caches a group managed service account on a computer.

SYNTAX


Install-ADServiceAccount [-Identity] <ADServiceAccount> [-AccountPassword <SecureString>] [-AuthType {Negotiate | Basic}] [-Force] [-PromptForPassword] [-Confirm] [-WhatIf]
[<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Install-ADServiceAccount cmdlet installs an existing Active Directory managed service account (MSA) on the computer on which the cmdlet is run. This cmdlet verifies that
the computer is eligible to host the MSA. The cmdlet also makes the required changes locally so that the MSA password can be managed without requiring any user action.


The Identity parameter specifies the Active Directory MSA to install. You can identify a MSA by its distinguished name Members (DN), GUID, security identifier (SID) or
Security Accounts Manager (SAM) account name. You can also set the parameter to a MSA object variable, such as $<localServiceaccountObject> or pass a MSA object through the
pipeline to the Identity parameter. For example, you can use Get-ADServiceAccount to get a MSA object and then pass the object through the pipeline to the
Install-ADServiceAccount.


The AccountPassword parameter allows you to pass a SecureString that contains the password of a standalone MSA and is ignored for group MSAs. Alternatively you can use
PromptForPassword parameter to be prompted for the standalone MSA password. You need to enter the password of a standalone MSA if you want to install an account that you
have pre-provisioned early on. This is required when you are installing a standalone MSA on a server located on a segmented network (site) with no access to writable DCs but
only RODCs (e.g. perimeter network or DMZ). In this case you should create the standalone MSA, link it with the appropriate computer account and assign a well-known password
that needs to be passed when installing the standalone MSA on the server on the RODC-only site with no access to writable DCs. If you pass both AccountPassword and
PromptForPassword parameters the AccountPassword parameter takes precedence.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=291056
Get-ADServiceAccount
New-ADServiceAccount
Remove-ADServiceAccount
Reset-ADServiceAccountPassword
Set-ADServiceAccount
Uninstall-ADServiceAccount

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

PS C:\>Install-ADServiceAccount -Identity 'SQL-HR-svc-01'



This command installs a Managed Service Account with name SQL-HR-svc-01 on the local computer. If a Group Managed Service Account is used, the service account must have the
PrincipalsAllowedToRetrieveManagedPassword property set.




-------------------------- EXAMPLE 2 --------------------------

PS C:\>$a = Get-ADServiceAccount -Filter { Name -eq 'SQL-HR-svc-01'}
PS C:\> Install-ADServiceAccount $a



This command gets a Managed Service Account with name SQL-HR-svc-01 from the default directory and installs it on the local machine. If a Group Managed Service Account is
used, the service account must have the PrincipalsAllowedToRetrieveManagedPassword property set.




-------------------------- EXAMPLE 3 --------------------------

PS C:\>Install-ADServiceAccount -Identity 'SQL-HR-svc-01' -PromptForPassword
Please enter the current password for 'CN=SQL-HR-svc-01,CN=Managed Service Accounts,DC=contoso,DC=com'
Password: *******



This command installs a standalone Managed Service Account with name SQL-HR-svc-01 in a RODC-only site with not access to writable DCs. If a Group Managed Service Account is
used, the service account must have the PrincipalsAllowedToRetrieveManagedPassword property set.




-------------------------- EXAMPLE 4 --------------------------

PS C:\>Install-ADServiceAccount -Identity 'SQL-HR-svc-01' -AccountPassword (ConvertTo-SecureString -AsPlainText "p@ssw0rd" -Force)



This command installs a standalone Managed Service Account with name SQL-HR-svc-01 in a RODC-only site with not access to writable DCs passing the account password as a
secure string. If a Group Managed Service Account is used, the service account must have the PrincipalsAllowedToRetrieveManagedPassword property set.