added parameters to only allow gpg if zip is password, added new line output for after bw commands
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
param (
|
||||
[switch]$zip,
|
||||
[switch]$gpg
|
||||
[Parameter(ParameterSetName='One',Mandatory=$true)][switch]$zip,
|
||||
[Parameter(ParameterSetName='One')][switch]$gpg
|
||||
)
|
||||
|
||||
# get the date/time for the back filename
|
||||
@@ -49,6 +49,8 @@ $itemsWithAttachments | foreach {
|
||||
$_.attachments | foreach {
|
||||
Write-Verbose "Downloading attachment ($($_.id)) with name $($_.fileName) to $folder."
|
||||
bw get attachment $_.id --itemid $itemID --output "$folder\$($_.fileName)" --session $sessionKey
|
||||
# just writing a new line
|
||||
Write-Host " "
|
||||
sleep -Milliseconds 500
|
||||
}
|
||||
}
|
||||
@@ -58,12 +60,14 @@ $zipFilename = "Bitwarden Backup $dateTime.zip"
|
||||
if ($zip) {
|
||||
Write-Host "Zipping the backup together..."
|
||||
Compress-Archive -Path $PSScriptRoot\*.csv, $PSScriptRoot*.json, $PSScriptRoot\attachments -DestinationPath "$PSScriptRoot\$zipFilename"
|
||||
|
||||
if ($gpg) {
|
||||
Write-Host "Encrypting the backup zip with your bitwarden password..."
|
||||
gpg.exe --symmetric --cipher-algo AES256 --digest-algo SHA512 --output "$PSScriptRoot\$zipFilename.gpg" "$PSScriptRoot\$zipFilename"
|
||||
}
|
||||
}
|
||||
|
||||
if ($gpg) {
|
||||
Write-Host "Encrypting the backup zip with your bitwarden password..."
|
||||
gpg.exe --symmetric --cipher-algo AES256 --digest-algo SHA512 --output "$PSScriptRoot\$zipFilename.gpg" "$PSScriptRoot\$zipFilename"
|
||||
}
|
||||
|
||||
|
||||
Remove-Variable -Name * -ErrorAction SilentlyContinue
|
||||
bw logout
|
||||
Reference in New Issue
Block a user