updated .gitignore, fixed typo, moved attachments to folder

This commit is contained in:
2021-11-24 10:08:59 -05:00
parent 2538de407b
commit 72bf350f53
2 changed files with 7 additions and 5 deletions

4
.gitignore vendored
View File

@@ -2,4 +2,6 @@
*.gpg
*.asc
*.pgp
*.csv
*.json
attachments/

View File

@@ -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
bw logout