Install a module using Install-PSResource without specifying the repository
Wait long enough for the secret store timeout to expire
Try and install another module using Install-PSRespository
Expected behavior
Prompted to enter the password, after which the module (and dependencies, though I know that doesn't work properly either) should be installed.
Actual behavior
Exception thrown:
Install-PSResource: C:\Code\repo\Setup-Site.ps1:17
Line |
17 | Install-PSResource MyCompany.PowerShell.RavenDB
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Exception calling "WriteObject" with "3" argument(s): "A valid password is required to access the Microsoft.PowerShell.SecretStore vault. Use the Unlock-SecretStore cmdlet
| to provide the required password to access the store."
### Error details
```console
PS C:\Users\Teatowel> get-error
Type : System.Management.Automation.ActionPreferenceStopException
ErrorRecord :
Exception :
Type : System.Management.Automation.MethodInvocationException
ErrorRecord :
Exception :
Type : System.Management.Automation.ParentContainsErrorRecordException
Message : Exception calling "WriteObject" with "3" argument(s): "A valid password is required to access the Microsoft.PowerShell.SecretStore vault.
Use the Unlock-SecretStore cmdlet to provide the required password to access the store."
HResult : -2146233087
CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
FullyQualifiedErrorId : PasswordRequiredException
InvocationInfo :
ScriptLineNumber : 309
OffsetInLine : 5
HistoryId : 1
ScriptName :
C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretStore\1.0.6\Microsoft.PowerShell.SecretStore.Extension\Microsoft.PowerShell.SecretStore.Extension.psm1
Line : $success = [Microsoft.PowerShell.SecretStore.LocalSecretStore]::GetInstance().WriteObject(
Statement : $success = [Microsoft.PowerShell.SecretStore.LocalSecretStore]::GetInstance().WriteObject(
$secretName,
$secret,
[ref] $errorMsg)
PositionMessage : At C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretStore\1.0.6\Microsoft.PowerShell.SecretStore.Extension\Microsoft.P
owerShell.SecretStore.Extension.psm1:309 char:5
+ $success = [Microsoft.PowerShell.SecretStore.LocalSecretStore]::G …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PSScriptRoot : C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretStore\1.0.6\Microsoft.PowerShell.SecretStore.Extension
PSCommandPath :
C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretStore\1.0.6\Microsoft.PowerShell.SecretStore.Extension\Microsoft.PowerShell.SecretStore.Extension.psm1
CommandOrigin : Internal
ScriptStackTrace : at Test-SecretVault,
C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretStore\1.0.6\Microsoft.PowerShell.SecretStore.Extension\Microsoft.PowerShell.SecretStore.Extension.psm1:
line 309
at <ScriptBlock>, <No file>: line 19
TargetSite :
Name : ConvertToMethodInvocationException
DeclaringType : System.Management.Automation.ExceptionHandlingOps, System.Management.Automation, Version=7.4.1.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35
MemberType : Method
Module : System.Management.Automation.dll
Message : Exception calling "WriteObject" with "3" argument(s): "A valid password is required to access the Microsoft.PowerShell.SecretStore vault.
Use the Unlock-SecretStore cmdlet to provide the required password to access the store."
Data : System.Collections.ListDictionaryInternal
InnerException :
Type : Microsoft.PowerShell.SecretManagement.PasswordRequiredException
TargetSite :
Name : get_Password
DeclaringType : Microsoft.PowerShell.SecretStore.SecureStore, Microsoft.PowerShell.SecretStore, Version=1.0.6.0, Culture=neutral, PublicKeyToken=null
MemberType : Method
Module : Microsoft.PowerShell.SecretStore.dll
Message : A valid password is required to access the Microsoft.PowerShell.SecretStore vault.
Use the Unlock-SecretStore cmdlet to provide the required password to access the store.
Source : Microsoft.PowerShell.SecretStore
HResult : -2146233079
StackTrace :
at Microsoft.PowerShell.SecretStore.SecureStore.get_Password() in D:\a\_work\1\s\src\code\Utils.cs:line 1215
at Microsoft.PowerShell.SecretStore.LocalSecretStore.WriteObject[T](String name, T objectToWrite, Hashtable metadata, String& errorMsg) in
D:\a\_work\1\s\src\code\Utils.cs:line 3244
at CallSite.Target(Closure, CallSite, Object, Object, Object, PSReference)
Source : System.Management.Automation
HResult : -2146233087
StackTrace :
at System.Management.Automation.ExceptionHandlingOps.ConvertToMethodInvocationException(Exception exception, Type typeToThrow, String methodName, Int32 numArgs, MemberInfo
memberInfo)
at CallSite.Target(Closure, CallSite, Object, Object, Object, PSReference)
at System.Management.Automation.Interpreter.DynamicInstruction`5.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
CategoryInfo : NotSpecified: (:) [Install-PSResource], MethodInvocationException
FullyQualifiedErrorId : PasswordRequiredException,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource
InvocationInfo :
MyCommand : Install-PSResource
ScriptLineNumber : 17
OffsetInLine : 1
HistoryId : 1
ScriptName : C:\Code\repo\Setup-Site.ps1
Line : Install-PSResource MyCompany.PowerShell.RavenDB
Statement : Install-PSResource MyCompany.PowerShell.RavenDB
PositionMessage : At C:\Code\repo\Setup-Site.ps1:17 char:1
+ Install-PSResource MyCompany.PowerShell.RavenDB
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PSScriptRoot : C:\Code\repo
PSCommandPath : C:\Code\repo\Setup-Site.ps1
InvocationName : Install-PSResource
CommandOrigin : Internal
ScriptStackTrace : at Test-SecretVault,
C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretStore\1.0.6\Microsoft.PowerShell.SecretStore.Extension\Microsoft.PowerShell.SecretStore.Extension.psm1:
line 309
at <ScriptBlock>, <No file>: line 19
PipelineIterationInfo :
TargetSite :
Name : Invoke
DeclaringType : System.Management.Automation.Runspaces.PipelineBase, System.Management.Automation, Version=7.4.1.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35
MemberType : Method
Module : System.Management.Automation.dll
Message : The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Exception calling "WriteObject" with "3"
argument(s): "A valid password is required to access the Microsoft.PowerShell.SecretStore vault.
Use the Unlock-SecretStore cmdlet to provide the required password to access the store."
Data : System.Collections.ListDictionaryInternal
Source : System.Management.Automation
HResult : -2146233087
StackTrace :
at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
at Microsoft.PowerShell.Executor.ExecuteCommandHelper(Pipeline tempPipeline, Exception& exceptionThrown, ExecutionOptions options)
Environment data
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Binary 1.0.2 Microsoft.PowerShell.PSResourceGet {Find-PSResource, Get-InstalledPSResource, Get-PSResourceRepository, Get-PSScriptFileInfo…}
Key : PSVersion
Value : 7.4.1
Name : PSVersion
Key : PSEdition
Value : Core
Name : PSEdition
Key : GitCommitId
Value : 7.4.1
Name : GitCommitId
Key : OS
Value : Microsoft Windows 10.0.19045
Name : OS
Key : Platform
Value : Win32NT
Name : Platform
Key : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0…}
Name : PSCompatibleVersions
Key : PSRemotingProtocolVersion
Value : 2.3
Name : PSRemotingProtocolVersion
Key : SerializationVersion
Value : 1.1.0.1
Name : SerializationVersion
Key : WSManStackVersion
Value : 3.0
Name : WSManStackVersion
Prerequisites
Steps to reproduce
Install-PSResource
without specifying the repositoryInstall-PSRespository
Expected behavior
Actual behavior
Environment data
Visuals
No response