From f93716d141269a65419008409b0e7cd1c1f95e48 Mon Sep 17 00:00:00 2001 From: Thomas Parkison Date: Thu, 7 Mar 2024 18:15:29 -0500 Subject: [PATCH] Introduced a force logout execution flag. --- Export-Bitwarden.psd1 | 2 +- Export-Bitwarden.psm1 | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Export-Bitwarden.psd1 b/Export-Bitwarden.psd1 index 4783f9e..302a591 100644 --- a/Export-Bitwarden.psd1 +++ b/Export-Bitwarden.psd1 @@ -12,7 +12,7 @@ RootModule = 'Export-Bitwarden.psm1' # Version number of this module. -ModuleVersion = '1.40' +ModuleVersion = '1.41' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/Export-Bitwarden.psm1 b/Export-Bitwarden.psm1 index 25200e1..6a96cb5 100644 --- a/Export-Bitwarden.psm1 +++ b/Export-Bitwarden.psm1 @@ -14,7 +14,8 @@ function Export-Bitwarden { # Don't touch this line! param ( - [switch]$forcebwcliupdate + [switch]$forcebwcliupdate, + [switch]$forcelogpout ) # This tells the script if it should automatically check for an update of the Bitwarden CLI executable that's actually responsible for backing up your Bitwarden vault. @@ -31,7 +32,7 @@ function Export-Bitwarden { # Don't touch this line! # == WARNING!!! DO NOT TOUCH ANYTHING BELOW THIS!!! == # ==================================================== - $ver = "1.40" + $ver = "1.41" Write-Host -ForegroundColor Green "========================================================================================" Write-Host -ForegroundColor Green "== Bitwarden Vault Export Script v$ver ==" @@ -194,6 +195,19 @@ function Export-Bitwarden { # Don't touch this line! Write-Host "" } + if ($forcelogpout) { + LockAndLogout + Write-Host "Exiting script." + $env:BW_SESSION = "" + $bwPasswordEncrypted = "" + $bwPasswordPlainText = "" + $password1Encrypted = "" + $password1PlainText = "" + $password2Encrypted = "" + $password2PlainText = "" + return + } + # Prompt user for their Bitwarden username $userEmail = Read-Host "Enter your Bitwarden Username"