How to relock a Bitlocker drive after you've unlocked it with PowerShell

If you're using Windows Server 2012 or above you can use PowerShell to relock a bitlocker drive that you have already unlocked

Lock-BitLocker E:

However if the drive is in use you may see this error

Lock-BitLocker : Access is denied. (Exception from HRESULT: 0x80070005
(E_ACCESSDENIED))
At line:1 char:1
+ Lock-BitLocker E:
+ ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], UnauthorizedAcc
   essException
    + FullyQualifiedErrorId : System.UnauthorizedAccessException,Lock-BitLocke
   r
 

This is simple to resolve - simply add the -ForceDismount parameter
Lock-BitLocker E: -ForceDismount  



Comments

Popular posts from this blog

SOLVED: Exchange Online Management PowerShell Connect-ExchangeOnline bug "A window handle must be configured. See https://aka.ms/msal-net-wam#parent-window-handles"

System error 86 has occurred. The specified network password is not correct.

The security identifier of the "NT SERVICE\WdiServiceHost" account is "S-1-5-80-3139157870-2983391045-3678747466-658725712-1809340420"