Set-SPManagedAccount
Applies to: SharePoint Server 2010, SharePoint Foundation 2010
Topic Last Modified: 2010-05-07
Configures the managed account.
Set-SPManagedAccount [-Identity] <SPManagedAccountPipeBind> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-EmailNotification <Int32>] [-PreExpireDays <Int32>] [-Schedule <String>] [-WhatIf [<SwitchParameter>]]
Set-SPManagedAccount [-Identity] <SPManagedAccountPipeBind> [-AssignmentCollection <SPAssignmentCollection>] [-AutoGeneratePassword <SwitchParameter>] [-Confirm [<SwitchParameter>]] [-EmailNotification <Int32>] [-PreExpireDays <Int32>] [-Schedule <String>] [-WhatIf [<SwitchParameter>]]
Set-SPManagedAccount [-Identity] <SPManagedAccountPipeBind> -Password <SecureString> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-EmailNotification <Int32>] [-PreExpireDays <Int32>] [-Schedule <String>] [-WhatIf [<SwitchParameter>]]
Set-SPManagedAccount [-Identity] <SPManagedAccountPipeBind> -ConfirmPassword <SecureString> -NewPassword <SecureString> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-EmailNotification <Int32>] [-PreExpireDays <Int32>] [-Schedule <String>] [-SetNewPassword <SwitchParameter>] [-WhatIf [<SwitchParameter>]]
Set-SPManagedAccount [-Identity] <SPManagedAccountPipeBind> -ExistingPassword <SecureString> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-EmailNotification <Int32>] [-PreExpireDays <Int32>] [-Schedule <String>] [-UseExistingPassword <SwitchParameter>] [-WhatIf [<SwitchParameter>]]
This cmdlet contains more than one parameter set. You may only use parameters from one parameter set, and you may not combine parameters from different parameter sets. For more information about how to use parameter sets, see Cmdlet Parameter Sets.
The Set-SPManagedAccount cmdlet sets the properties on the given managed account.
You can use this cmdlet to change the password expiration and notification settings for the managed account: Use the default parameter set. Additionally, you can use this cmdlet to change the password for the managed account to automatically generated passwords on a set schedule: Use the parameter set that includes the AutoGeneratePassword parameter. You can also use this cmdlet to change the password for the managed account to a new value, known to the administrator: Use the parameter set that includes the SetNewPassword parameter. Finally, you can use this cmdlet to change the password for the managed account to an existing value that has been already been changed in Active Directory Domain Services (AD DS): Use the parameter set that includes the UseExistingPassword parameter.
| Parameter | Required | Type | Description | ||
|---|---|---|---|---|---|
| Identity | Required | Microsoft.SharePoint.PowerShell.SPManagedAccountPipeBind | Specifies the full name or partial name of the managed accounts to retrieve. The type must be a valid account name, in the form Domain\User, or a GUID, in the form 1234-3456-09876. | ||
| ConfirmPassword | Required | System.Security.SecureString | Confirms the new password for this managed account. | ||
| ExistingPassword | Required | System.Security.SecureString | Sets the password for this managed account to an existing value that has already been changed in Active Directory Domain Services (AD DS). | ||
| NewPassword | Required | System.Security.SecureString | Sets a new password for the managed account | ||
| Password | Required | System.Security.SecureString | Sets a password for the managed account. | ||
| AssignmentCollection | Optional | Microsoft.SharePoint.PowerShell.SPAssignmentCollection | Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.
| ||
| AutoGeneratePassword | Optional | System.Management.Automation.SwitchParameter | Automatically generates a new password. The type must be either of the following values: - True - False The default value is False. | ||
| Confirm | Optional | System.Management.Automation.SwitchParameter | Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters | ||
| EmailNotification | Optional | System.Int32 | Specifies the number of days before password change to begin e-mail notifications. The default value is 5. | ||
| PreExpireDays | Optional | System.Int32 | Specifies the number of days before expiration to schedule password change. The default value is 2. | ||
| Schedule | Optional | System.String | Specifies the new schedule on which the password change job is to run. | ||
| SetNewPassword | Optional | System.Management.Automation.SwitchParameter | Sets the password to the new value that is passed in, and changes the value in AD DS. The type must be either of the following values: - True - False The default value is False. | ||
| UseExistingPassword | Optional | System.Management.Automation.SwitchParameter | Sets the password to a new value passed in where the value is already changed in AD DS. The type must be either of the following values: - True - False The default value is False. | ||
| WhatIf | Optional | System.Management.Automation.SwitchParameter | Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters |
------------------EXAMPLE-----------------------
$m = Get-SPManagedAccount -Identity "DOMAINx\UserY"
Set-SPManagedAccount -Identity $m -AutoGeneratePassword true
This example displays an explicit managed account if it exists, and then attempts to update it to use automatically generated passwords.

Note