Compartilhar via


Install-ADServiceAccount

Install-ADServiceAccount

Installs an Active Directory service account on a computer.

Syntax

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

  • Force

  • AuthType

  • Confirm

  • WhatIf

Detailed Description

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

The Identity parameter specifies the Active Directory service account to install. You can identify a service account 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 service account object variable, such as $<localServiceaccountObject> or pass a service account object through the pipeline to the Identity parameter. For example, you can use Get-ADServiceAccount to get a service account object and then pass the object through the pipeline to the Install-ADServiceAccount.

Parameters

AuthType

Specifies the authentication method to use. Possible values for this parameter include:
Negotiate or 0
Basic or 1

The default authentication method is Negotiate.

A Secure Sockets Layer (SSL) connection is required for the Basic authentication method.

The following example shows how to set this parameter to Basic.
-AuthType Basic

The following lists the acceptable values for this parameter:

  • Negotiate**

  • Basic**

Default Value: Microsoft.ActiveDirectory.Management.AuthType.Negotiate

Data Type: ADAuthType

Attributes

Name Value PSMAML Attribute

Required?

false

required

Variable Length?

false

variableLength

Accept wildcard characters?

false

globbing

Accept Pipeline Input?

false

pipelineInput

Position?

named

position

Value Attributes

Name Value PSMAML Attribute

Required?

true

required

Variable Length?

false

variableLength

Force

Default Value: **

Data Type: SwitchParameter

Attributes

Name Value PSMAML Attribute

Required?

false

required

Variable Length?

false

variableLength

Accept wildcard characters?

false

globbing

Accept Pipeline Input?

false

pipelineInput

Position?

named

position

Value Attributes

Name Value PSMAML Attribute

Required?

false

required

Variable Length?

false

variableLength

Identity

Specifies an Active Directory account object by providing one of the following property values. The identifier in parentheses is the LDAP display name for the attribute.

Distinguished Name
Example: CN=WebAccount,CN=ManagedServiceAccounts,DC=corp,DC=contoso,DC=com
GUID (objectGUID)
Example: 599c3d2e-f72d-4d20-8a88-030d99495f20
Security Identifier (objectSid)
Example: S-1-5-21-3165297888-301567370-576410423-1103
SAM Account Name (sAMAccountName)
Example: WebAccount$

The cmdlet searches the default naming context or partition to find the object. If two or more objects are found, the cmdlet returns a non-terminating error.

This parameter can also get this object through the pipeline or you can set this parameter to an object instance.

This example shows how to set the parameter to a distinguished name.
-Identity "CN=WebAccount,CN=ManagedServiceAccounts,DC=corp,DC=contoso,DC=com"

This example shows how to set this parameter to an account object instance named "AccountInstance".
-Identity $AccountInstance

Default Value: **

Data Type: ADServiceAccount

Attributes

Name Value PSMAML Attribute

Required?

true

required

Variable Length?

false

variableLength

Accept wildcard characters?

false

globbing

Accept Pipeline Input?

true (ByValue)

pipelineInput

Position?

1

position

Value Attributes

Name Value PSMAML Attribute

Required?

true

required

Variable Length?

false

variableLength

Confirm

Prompts you for confirmation before executing the command.

Default Value: **

Data Type: SwitchParameter

Attributes

Name Value PSMAML Attribute

Required?

false

required

Variable Length?

true

variableLength

Accept wildcard characters?

false

globbing

Accept Pipeline Input?

false

pipelineInput

Position?

named

position

Value Attributes

Name Value PSMAML Attribute

Required?

false

required

Variable Length?

false

variableLength

WhatIf

Describes what would happen if you executed the command without actually executing the command.

Default Value: **

Data Type: SwitchParameter

Attributes

Name Value PSMAML Attribute

Required?

false

required

Variable Length?

true

variableLength

Accept wildcard characters?

false

globbing

Accept Pipeline Input?

false

pipelineInput

Position?

named

position

Value Attributes

Name Value PSMAML Attribute

Required?

false

required

Variable Length?

false

variableLength

Input Type

Microsoft.ActiveDirectory.Management.ADServiceAccount

A service account object is received by the Identity parameter.

Return Type

None

Notes

  • This cmdlet does not work with AD LDS.
    This cmdlet does not work with an Active Directory Snapshot.
    This cmdlet does not work with a read-only domain controller.

Examples

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

Command Prompt: C:\PS>

Install-ADServiceAccount -Identity 'SQL-HR-svc-01' 


                          

Install a Service Account with the name 'SQL-HR-svc-01' on the local computer.

Description

-----------

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

Command Prompt: C:\PS>

$a = Get-ADServiceAccount -Filter { Name -eq 'SQL-HR-svc-01'} 

Install-ADServiceAccount $a 

Get a Service Account named 'SQL-HR-svc-01' from the default directory and install it on the local machine.

See Also

Reference

Uninstall-ADServiceAccount
Get-ADServiceAccount
Remove-ADServiceAccount
New-ADServiceAccount
Set-ADServiceAccount
Reset-ADServiceAccountPassword

Other Resources

Online version: