25 lines
1.1 KiB
PowerShell
25 lines
1.1 KiB
PowerShell
# get the date/time for the back filename
|
|
$dateTime = get-date -format ("yyyyMMdd-HHmmss")
|
|
$directory = "$PSScriptRoot\Bitwarden Backup Working Directory"
|
|
$filename = "Bitwarden Backup $dateTime"
|
|
|
|
$env:Path += ";$PSScriptRoot\lib;$PSScriptRoot\lib\gpg\bin"
|
|
|
|
# update server for BW CLI
|
|
bw.exe config server https://bitwarden.johnhgaunt.com
|
|
|
|
# create the backup directory
|
|
New-Item -ItemType directory -Force -Path "$directory" | out-null
|
|
|
|
# backup bitwarden
|
|
portwarden_windows_amd64.exe --passphrase "thisISaVerySecURepassWorD!" --filename "$directory\$filename.portwarden" encrypt
|
|
portwarden_windows_amd64.exe --passphrase "thisISaVerySecURepassWorD!" --filename "$directory\$filename.portwarden" decrypt
|
|
|
|
# rename the zip file from .portwarden.decrypted.zip to just .zip
|
|
rename-item "$directory\$filename.portwarden.decrypted.zip" "$directory\$filename.zip"
|
|
|
|
# gpg encrypt while asking for the password
|
|
gpg.exe --symmetric --cipher-algo AES256 --digest-algo SHA512 --output "$PSScriptRoot\$filename.zip.gpg" "$directory\$filename.zip"
|
|
|
|
# delete files and wipe item
|
|
sdelete64.exe -nobanner -accepteula -s -p 10 "$directory" |