Skip to content

Set-PSSMSecretStorePassword

SecretManagement: Changes the SecretStore password

#Requires -Version 5.1
#Requires -Modules Microsoft.PowerShell.SecretStore

[CmdletBinding()]
Param(
    [Parameter(Mandatory = $true)]
    [securestring]$CurrentStorePassword,

    [Parameter(Mandatory = $true)]
    [securestring]$NewStorePassword
)

Process {
    try {
        $result = Set-SecretStorePassword -NewPassword $NewStorePassword -Password $CurrentStorePassword -ErrorAction Stop | Select-Object *
        if ($null -ne $result) { $result | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format "yyyy-MM-dd HH:mm:ss") -PassThru -Force }
    }
    catch { throw }
}

Current password to access the SecretStore

New password to access the SecretStore

An interactive directory of PowerShell scripts.