微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

禁用 SecretStore 密码提示以实现自动化

如何解决禁用 SecretStore 密码提示以实现自动化

我想在自动化中使用 secretstore,但是,我无法摆脱密码提示。我采取的步骤如下:

1- 重置 secretstore -> 要求输入密码(强制)。

2- 将交互设置为无 -> 返回错误

3- 解锁 -> 要求输入密码

输出可以在下面列出:

PS /home/mahmood> Reset-secretstore -Passthru
WARNING: !!This operation completely removes all secretstore module secrets and resets configuration settings to new values!!

Reset secretstore
Are you sure you want to erase all secrets in secretstore and reset configuration settings to default?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): y
Creating a new Microsoft.PowerShell.secretstore vault. A password is required by the current store configuration.
Enter password:
************
Enter password again for verification:
************

      Scope Authentication PasswordTimeout Interaction
      ----- -------------- --------------- -----------
CurrentUser       Password             900      Prompt

PS /home/mahmood> Set-secretstoreConfiguration -Interaction None

Confirm
Are you sure you want to perform this action?
Performing the operation "Changes local store configuration" on target "secretstore module local store".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y
PS /home/mahmood> Get-secretstoreConfiguration
Get-secretstoreConfiguration: 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.
PS /home/mahmood> Unlock-secretstore

cmdlet Unlock-secretstore at command pipeline position 1
Supply values for the following parameters:
Password: ************
PS /home/mahmood> Get-secretstoreConfiguration

      Scope Authentication PasswordTimeout Interaction
      ----- -------------- --------------- -----------
CurrentUser       Password             900        None

如您所见,虽然交互现在是“无”,但是,当我重新运行 pwsh 命令时,get 配置不再起作用。

PS /home/mahmood> exit
mahmood@Frontend:~$ pwsh
PowerShell 7.1.3
copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

PS /home/mahmood> Get-secretstoreConfiguration
Get-secretstoreConfiguration: 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.

我该如何解决

解决方法

您可以使用 Set-SecretStoreConfiguration -Authentication None 永久禁用您的机密存储的密码身份验证。系统会要求您提供两次当前密码,作为确认,然后您就应该设置好了。

之前:

PS> Get-SecretStoreConfiguration

      Scope Authentication PasswordTimeout Interaction
      ----- -------------- --------------- -----------
CurrentUser       Password             900      Prompt

禁用

PS> Set-SecretStoreConfiguration -Authentication None
Confirm
Are you sure you want to perform this action?
Performing the operation "Changes local store configuration" on target "SecretStore module local store".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y
Vault Microsoft.PowerShell.SecretStore requires a password.
Enter password:
******
A password is no longer required for the local store configuration.
To complete the change please provide the current password.
Enter password:
******

之后:

PS> Get-SecretStoreConfiguration

      Scope Authentication PasswordTimeout Interaction
      ----- -------------- --------------- -----------
CurrentUser           None             900      Prompt

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?