Reset the service account password for a computer.

      Reset-ADServiceAccountPassword [-Identity] ADServiceAccount
         [-AuthType {Negotiate | Basic}] [-Credential PSCredential]
            [-Partition string] [-Server string]
               [-Confirm] [-WhatIf] [CommonParameters]

   -AuthType {Negotiate | Basic}
       The authentication method to use: Negotiate (or 0), Basic (or 1)
       A Secure Sockets Layer (SSL) connection is required for Basic authentication.

   -Credential PSCredential
       A user account that has permission to perform this action.
       The default is the current user unless the cmdlet is run from an AD PowerShell provider drive
       in which case the account associated with the drive is the default.

       "User64" or "Domain01\User64" or a PSCredential object.

   -Identity ADServiceAccount
       Specify an AD domain object by providing one of the following values.
       (The identifier in parentheses is the LDAP provider name for the attribute.)

          Distinguished Name 
            Example: DC=Helvetia,DC=corp,DC=SS64,DC=com 
          GUID (objectGUID) 
            Example: 599c4d2e-f72d-4d20-8a78-030d69495f20
          Security Identifier (objectSid) 
            Example: S-1-5-21-5165297888-301467370-576410423-1803
          Security Accounts Manager (SAM) Account Name (sAMAccountName)
            Example: Helvetia

       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.

   -Partition string
       The distinguished name of an AD partition.
       The distinguished name must be one of the naming contexts on the current
       directory server. The cmdlet searches this partition to find the object defined by
       the -Identity parameter. 
       The following two examples show how to specify a value for this parameter.
          -Partition "CN=Configuration,DC=Europe,DC=Test,DC=SS64,DC=com"
          -Partition "CN=Schema,CN=Configuration,DC=Europe,DC=Test,DC=SS64,DC=com"
       In many cases, a default value will be used for -Partition if no value is specified.

   -Server string
       The AD Domain Services instance to connect to, this may be a Fully qualified domain name,
       NetBIOS name, Fully qualified directory server name (with or without port number) or AD Snapshot instance.

       Examples:  demo

       Prompt for confirmation before executing the command.

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

Reset-ADServiceAccountPassword resets a service account password on the local computer. This cmdlet needs to be run on the computer where the service account is installed.

The -Identity parameter specifies the Active Directory service account that receives the password reset.
-Identity may also be set to a service account object variable, such as $localServiceAccountObject, or passed through the pipeline. For example from Get-ADServiceAccount.

Resetting the password for a computer account will also reset all of the Managed Service Account (MSAs) passwords on that computer.


Reset the password on the service account 'sqlagent':

PS C:\> Reset-ADServiceAccountPassword -Identity sqlagent

“I changed all my passwords to 'incorrect'. So my computer just tells me when I forget” ~ Unknown

Related PowerShell Cmdlets

Get-adServiceAccount - Get one or more AD service accounts.
Remove-adServiceAccount - Remove an AD service account.
Set-adServiceAccount - Modify an AD service account.
Set-adAccountPassword - Modify the password of an AD account.

Copyright © 1999-2023
Some rights reserved