Powershell: Bitlocker 암호화 드라이브를 간단하게 잠금 해제하는 방법은 무엇입니까?

Powershell: 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:비트잠금 볼륨으로 교체하세요 .

확실하게 하다Runas Admin


Auto Lock-UnlockBitlocked 드라이브 에 이 기능을 사용합니다.

#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

답변2

다음 powershell 스크립트를 사용하여 비밀번호를 묻는 메시지를 표시하고 안전하게 입력한 후 나머지 스크립트를 실행할 수 있습니다.

$UserCredential = Get-Credential -Message "Enter a password" -UserName "not applicable"

Unlock-Bitlocker -MountPoint x: -Password $UserCredential.Password

결과는 다음과 같습니다.

여기에 이미지 설명을 입력하세요

관련 정보