Set-SPManagedAccount

Configures the managed account.

Syntax

Set-SPManagedAccount
   [-Identity] <SPManagedAccountPipeBind>
   -ConfirmPassword <SecureString>
   -NewPassword <SecureString>
   [-AssignmentCollection <SPAssignmentCollection>]
   [-Confirm]
   [-EmailNotification <Int32>]
   [-PreExpireDays <Int32>]
   [-Schedule <String>]
   [-SetNewPassword]
   [-WhatIf]
   [<CommonParameters>]
Set-SPManagedAccount
   [-Identity] <SPManagedAccountPipeBind>
   -ExistingPassword <SecureString>
   [-AssignmentCollection <SPAssignmentCollection>]
   [-Confirm]
   [-EmailNotification <Int32>]
   [-PreExpireDays <Int32>]
   [-Schedule <String>]
   [-UseExistingPassword]
   [-WhatIf]
   [<CommonParameters>]
Set-SPManagedAccount
   [-Identity] <SPManagedAccountPipeBind>
   -Password <SecureString>
   [-AssignmentCollection <SPAssignmentCollection>]
   [-Confirm]
   [-EmailNotification <Int32>]
   [-PreExpireDays <Int32>]
   [-Schedule <String>]
   [-WhatIf]
   [<CommonParameters>]
Set-SPManagedAccount
   [-Identity] <SPManagedAccountPipeBind>
   [-AssignmentCollection <SPAssignmentCollection>]
   [-AutoGeneratePassword]
   [-Confirm]
   [-EmailNotification <Int32>]
   [-PreExpireDays <Int32>]
   [-Schedule <String>]
   [-WhatIf]
   [<CommonParameters>]

Description

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.

For permissions and the most current information about Windows PowerShell for SharePoint Products, see the online documentation at SharePoint Server Cmdlets.

Examples

------------------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.

Parameters

-AssignmentCollection

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.

When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.

Type:SPAssignmentCollection
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False
Applies to:SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019

-AutoGeneratePassword

Automatically generates a new password.

The type must be either of the following values:

  • True
  • False

The default value is False.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019

-Confirm

Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019

-ConfirmPassword

Confirms the new password for this managed account.

Type:SecureString
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019

-EmailNotification

Specifies the number of days before password change to begin e-mail notifications.

The default value is 5.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019

-ExistingPassword

Sets the password for this managed account to an existing value that has already been changed in Active Directory Domain Services (AD DS).

Type:SecureString
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019

-Identity

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.

Type:SPManagedAccountPipeBind
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False
Applies to:SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019

-NewPassword

Sets a new password for the managed account

Type:SecureString
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019

-Password

Sets a password for the managed account.

Type:SecureString
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019

-PreExpireDays

Specifies the number of days before expiration to schedule password change.

The default value is 2.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019

-Schedule

Specifies the new schedule on which the password change job is to run.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019

-SetNewPassword

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.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019

-UseExistingPassword

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.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019

-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019