Powershell - Enable Bitlocker & Create recovery txt file output network directory

Joshua Tyo 0 Reputation points
2023-02-06T16:21:23.6666667+00:00

Hello,

I have been searching to try and find a PowerShell set of commands or script to enable bit locker on remote machine and save the text recovery file to a UNC network path. I do not want to lock requiring pin or text to start the PC; just to save the text recovery to a different UNC location.

Would a command like this work?

Get-BitLockerVolume | Enable-BitLocker -EncryptionMethod Aes128 -RecoveryKeyPath "\SERVER\SHARE" -RecoveryKeyProtector

Also by doing this is there a way to avoid reboot?

Any help or guidance would be appreciated!

Windows for business Windows Server User experience PowerShell
{count} votes

2 answers

Sort by: Most helpful
  1. Anja B 15 Reputation points
    2024-03-28T16:33:32.05+00:00

    I don't know about remote machines but I made this PS script work on local machines:

    # Activate BitLocker on the C: drive
    Enable-BitLocker -MountPoint "C:" -RecoveryPasswordProtector -SkipHardwareTest
    # Get the BitLocker recovery key
    $recoveryKey = (Get-BitLockerVolume -MountPoint "C:").KeyProtector | Where-Object {$_.KeyProtectorType -eq 'RecoveryPassword'}
    # Save the recovery key to a file with computer name
    $computerName = $env:COMPUTERNAME
    $keyFileName = "${computerName}_Bitlocker.txt"
    $keyFilePath = Join-Path -Path 
    $recoveryKey.RecoveryPassword | Out-File -FilePath $keyFilePath
    Write-Host "BitLocker has been activated and the recovery key has been saved to $keyFilePath."
    
    1 person found this answer helpful.

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.