removed shorthand command aliases

This commit is contained in:
2022-06-06 20:38:52 -04:00
parent 662fc604cd
commit 42ef3870d9

View File

@@ -69,10 +69,10 @@ Write-Host " "
# look for organizations
Write-Host "Looking for Organizations..."
$organizations = $(ConvertFrom-Json $(& $bw list organizations --session $sessionKey))
Write-Host "Found $(($organizations | measure).count) Organiztaions."
Write-Host "Found $(($organizations | Measure-Object).count) Organiztaions."
# loop through the found organizations and again export both as CSV and JSON for best compatibility
$organizations | foreach {
$organizations | ForEach-Object {
Write-Host "Exporting organization $($_.name) vault to both CSV and JSON files."
Write-Verbose "Exporting organization vault to CSV."
& $bw export $password --organizationid $_.id --output "$PSScriptRoot\Bitwarden Organization $($_.name) Export $dateTime.csv" --format csv --session $sessionKey
@@ -87,20 +87,20 @@ $organizations | foreach {
# find all items with attachments
Write-Host "Looking for items with attachments..."
$itemsWithAttachments = $((ConvertFrom-Json $(& $bw list items --session $sessionKey)) | Where-Object attachments)
Write-Host "Found $(($itemsWithAttachments | measure).count) items with attachments."
Write-Host "Found $(($itemsWithAttachments | Measure-Object).count) items with attachments."
# loop through all the items with attachments and download them into a folder with the name of the item
Write-Host "Downloading attachments..."
$itemsWithAttachments | foreach {
$itemsWithAttachments | ForEach-Object {
Write-Verbose "Working on item $($_.name) ($($_.id))."
$folder="$PSScriptRoot\attachments\$($_.name)"
$itemID=$_.id
$_.attachments | foreach {
$_.attachments | ForEach-Object {
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
Start-Sleep -Milliseconds 500
}
}