Scripts/SecretStore.ps1
Install-Module -Name Microsoft.PowerShell.SecretManagement -Scope AllUsers Install-Module -Name Microsoft.PowerShell.SecretStore -Scope AllUsers Register-SecretVault -Name Vault -ModuleName Microsoft.PowerShell.SecretStore -DefaultVault Set-SecretStoreConfiguration -PasswordTimeout 28000 Install-Module SecretManagement.KeePass -Force -Scope AllUsers $SecretVault = Get-SecretVault -Name Automation_Passwords -ea 0 if (!($SecretVault)) { Register-SecretVault -Name "Automation_Passwords" -ModuleName "SecretManagement.Keepass" -VaultParameters @{ Path = "D:\Scripts\Automation_Passwords.kdbx" UseMasterPassword = $true } } $SecurePasswordPath = Join-Path $env:LOCALAPPDATA "KeepassPassword\password.xml" if (!(Test-Path $SecurePasswordPath)) { New-Item $SecurePasswordPath -Force -ItemType File | Out-Null Read-Host -Prompt "Enter the password for Keepass DB `"Automation_Passwords`"" -AsSecureString | Export-Clixml $SecurePasswordPath } $KeepassPassword = Import-Clixml -Path $SecurePasswordPath Unlock-SecretVault -Name Automation_Passwords -Password $KeepassPassword |