Skip to content

Instantly share code, notes, and snippets.

@mu88
Created April 22, 2021 06:56
Show Gist options
  • Save mu88/61760f56bbf93faca5ee2d54893623bb to your computer and use it in GitHub Desktop.
Save mu88/61760f56bbf93faca5ee2d54893623bb to your computer and use it in GitHub Desktop.
Combines KeePass and VeraCrypt for volume mounting
$KPScriptEXE = "C:\Program Files (x86)\KeePass Password Safe 2\KPScript.exe"
$KeePassFile = "C:\Users\me\Documents\me.kdbx"
$VeraCryptEXE = "C:\Program Files\VeraCrypt\VeraCrypt.exe"
$VeraCryptFile = "C:\Users\me\Documents\me.hc"
$VeraCryptEntryTitle = "VeraCrypt"
$output = & $KPScriptEXE -c:GetEntryString $KeePassFile -Field:Password -ref-Title:$VeraCryptEntryTitle -guikeyprompt
$pw = ($output -split '\n')[0]
$pw = $pw -replace "`n","" -replace "`r",""
& $VeraCryptEXE /q /v $VeraCryptFile /l u /p $pw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment