From baca57dd2b4d9f1b1ebacc0ec94406955dadab99 Mon Sep 17 00:00:00 2001 From: John Gaunt Date: Wed, 9 Feb 2022 10:25:58 -0500 Subject: [PATCH] added quick notes for restoring attachments --- bitwardenBackup.ps1 | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/bitwardenBackup.ps1 b/bitwardenBackup.ps1 index 8bf1245..50f6a58 100644 --- a/bitwardenBackup.ps1 +++ b/bitwardenBackup.ps1 @@ -148,4 +148,31 @@ if ($zip -or $encrypt) { # logout of bitwaren to ensure the session is destroyed & $bw logout # remove all the variables -Remove-Variable -Name * -ErrorAction SilentlyContinue \ No newline at end of file +Remove-Variable -Name * -ErrorAction SilentlyContinue + + + +<# + +# Restore of attachements + +cd C:\users\jgaunt\Git\bitwardenbackup\attachments + +bw status + +$folders = Get-childItem -Directory +$items = bw list items | convertfrom-json +$array = @() +foreach ($folder in $folders) { + foreach ($item in $items) { + if ($folder.name -eq $item.name -and $item.type -gt 1) { + #$array += bw get item $item.id | convertfrom-json + $attachements = Get-ChildItem $folder + foreach ($attachement in $attachements) { + bw create attachment --file "$($attachement.FullName)" --itemid $item.id + } + Remove-Item -Recurse $folder + } + } +} +#> \ No newline at end of file