20 lines
1.0 KiB
PowerShell
20 lines
1.0 KiB
PowerShell
# get the date/time for the back filename
|
|
$dateTime = get-date -format ("yyyyMMdd-HHmmss")
|
|
$env:Path += ";$PSScriptRoot\lib;$PSScriptRoot\lib\gpg\bin"
|
|
|
|
|
|
bw config server https://bitwarden.johnhgaunt.com
|
|
if ($sessionKey -eq $null) {
|
|
$username = "jgaunt@johnhgaunt.com"
|
|
$password = Read-Host -assecurestring "Please enter your bitwarden password: "
|
|
$password = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($password))
|
|
$code = Read-Host "Please enter your 2fa code: "
|
|
$sessionKey = $(bw login $username $password --method 0 --code $code --raw)
|
|
}
|
|
|
|
#convertfrom-json $(bw list organizations --session $sessionKey)
|
|
|
|
bw export $password --output "C:\users\jgaunt\3D Objects\Bitwarden User $username Export $dateTime.csv" --format csv --session $sessionKey
|
|
bw export $password --output "C:\users\jgaunt\3D Objects\Bitwarden User $username Export $dateTime.json" --format json --session $sessionKey
|
|
|
|
$organizations = $(convertfrom-json $(bw list organizations)) |