Last active
July 18, 2025 12:05
-
-
Save stopthatastronaut/840dd0cf9e297f2a76c96f260aa4de74 to your computer and use it in GitHub Desktop.
Import your local powershell env from a Dashlane Secure Note
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Import-Environment { | |
[CmdletBinding()] | |
param( | |
$SecureNote = 'EnvironmentVariables', | |
[switch]$KeepUnlocked | |
) | |
# setup to load secrets | |
Import-Module powershell-yaml | |
dcli sync | |
$yml = dcli note $SecureNote | |
$var = $yml | ConvertFrom-Yaml | |
$var.EnvironmentVars.GetEnumerator() | ForEach-Object { | |
Set-Item "Env:/$($_.Key)" -Value $_.Value | |
} | |
if(-not $KeepUnlocked) { | |
dcli lock | |
} else { | |
Write-Warning "KeepUnlocked was specified. Password manager unlocked." | |
} | |
} | |
Import-Environment |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment