Set-SPManagedAccount syntax for password resets

Set-SPManagedAccount syntax for password resets

Working with the PowerShell command for Set-SPManagedAccount this morning I found that the TechNet bulletin for this command has an inaccuracy with regard to password changes. 

When trying to reset a password from PowerShell I followed the syntax and used:

Set-SPManagedAccount –Identity domainaccount AutoGeneratePassword true

I got the following error:

Set-SPManagedAccount : A positional parameter cannot be found that accepts argument ‘true’.
At line:1 char:21
+ Set-SPManagedAccount <<<<  -Identity domainaccount -AutoGeneratePassword true
    + CategoryInfo          : InvalidArgument: (:) [Set-SPManagedAccount], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.SharePoint.PowerShell.SPCmdletSetManagedAccount

Turns out that the command has been changed and there is now no need for the “true” flag as the default is now “true” but you get the opportunity to choose (unless you pass the -confirm:$false flag)

The result of passing the command without the “true” looks like this:

Confirm
Are you sure you want to perform this action?
Performing operation “Set-SPManagedAccount” on Target “USsvc-ssaspfarm”.

[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help
(default is “Y”):


If you select “Y” the system will change the password for you with an automatically generated password.  If you want to validate the change an easy way to do it is to follow my previous blog post, http://sharepointlonghorn.com/how-to-get-your-managed-account-passwords-when-they-are-changed-automatically-by-sharepoint-2010/, to view the passwords before and after you run the command.

Leave a Reply

Your email address will not be published. Required fields are marked *