
BitLocker で暗号化されたドライブを簡単な方法でロック解除することは可能ですか?
コマンドラインでは次のようなものを使用します:
manage-bde -unlock -pw d:
次にパスワードを入力します。しかし、PowerShell の場合、これまでのところ、次のようなものが最善です。
Unlock-Bitlocker -MountPoint x: -Password (ConvertTo-Securestring "MyPassword" -AsPlainText -Force)
パスワードを安全な文字列に変換するのではなく、手動で入力したいだけです。mange-bde は PowerShell でも動作することは知っていますが、PowerShell でこれを簡単な方法で行う方法はあるのでしょうか?
答え1
$key = Read-Host 'Password!' -AsSecureString; Unlock-Bitlocker x: -Password $key >$nul
x:
Bitlocked ボリュームに置き換えます。
確認するRunas Admin
Auto Lock-Unlock
私はBitlocked Driveにこの機能を使用しています
#lock-unlock.ps1
function Bit {
GetAdmin
Clear-Host
$Drive = (BitlockerVolume | ? {$_.KeyProtector -like "Password"}).MountPoint
if ( !$Drive ) {'No Bitlocked Volume on This PC'; pause; exit 0}
$line = '------------------------'
if ( test-path $Drive ) {
"Volume `"$($Drive)`" Unlocked"; 'Lock it now ?'
$line
$ans = Read-Host "(Enter) Yes (AnyKey) Exit"
if ( $ans ) { exit 0 }
Lock-Bitlocker $Drive >$nul
} else {
"Volume `"$($Drive)`" Locked"; 'Unlock it now ?'
$line
$key = Read-Host 'Password!' -AsSecureString
if ( $key.length -ge 8 ) {
Unlock-Bitlocker $Drive -Password $key >$nul
# Replace to your path if want to open dir
#explorer "$($Drive)\#HF5-files"
}
}
Bit
}
function GetAdmin {
if ( $(fltmc).count -eq 3 ) {
$arg = "-NoProfile", "-ExecutionPolicy Bypass", "-File `"$PSCommandPath`""
Start -Verb RunAs powershell.exe -ArgumentList $arg; exit 0
}
}
####
Bit