diff --git a/.gitignore b/.gitignore index 3d1bf10..2770399 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ *.gpg *.asc *.pgp - +*.csv +*.json +attachments/ \ No newline at end of file diff --git a/backupBitwarden.ps1 b/backupBitwarden.ps1 index 0e36786..6bd63bb 100644 --- a/backupBitwarden.ps1 +++ b/backupBitwarden.ps1 @@ -23,7 +23,7 @@ Write-Verbose "Exporting vault to JSON." bw export $password --output "$PSScriptRoot\Bitwarden User $username Export $dateTime.json" --format json --session $sessionKey Write-Host "Looking for Organizations..." -$organizations = $(convertfrom-json $(bw list organizations --session $sessionKey)) +$organizations = $(ConvertFrom-Json $(bw list organizations --session $sessionKey)) Write-Host "Found $(($organizations | measure).count) Organiztaions." $organizations | foreach { @@ -35,12 +35,12 @@ $organizations | foreach { } Write-Host "Looking for items with attachments..." -$itemsWithAttachments = $((ConverFrom-Json $(bw list items --session $sessionKey)) | Where-Object attachments) +$itemsWithAttachments = $((ConvertFrom-Json $(bw list items --session $sessionKey)) | Where-Object attachments) Write-Host "Found $(($itemsWithAttachments | measure).count) items with attachments." Write-Host "Downloading attachments..." $itemsWithAttachments | foreach { Write-Verbose "Working on item $($_.name) ($($_.id))." - $folder="$PSScriptRoot\$($_.name)" + $folder="$PSScriptRoot\attachments\$($_.name)" $itemID=$_.id $_.attachments | foreach { Write-Verbose "Downloading attachment ($($_.id)) with name $($_.fileName) to $folder." @@ -50,4 +50,4 @@ $itemsWithAttachments | foreach { } Remove-Variable -Name * -ErrorAction SilentlyContinue -pause \ No newline at end of file +bw logout \ No newline at end of file