# BitLocker requires Windows Pro/Enterprise/Education (absent on Home).
PS>if (Get-Command Enable-BitLocker -ErrorAction SilentlyContinue) {
PS> Enable-BitLocker -MountPoint 'G:' -EncryptionMethod XtsAes256 -UsedSpaceOnly -RecoveryPasswordProtector -SkipHardwareTest
PS> if ('G:' -eq $env:SystemDrive) { Add-BitLockerKeyProtector -MountPoint 'G:' -TpmProtector } else { Enable-BitLockerAutoUnlock -MountPoint 'G:' }
# SAVE THIS BEFORE YOU REBOOT. The recovery password is the only
# way back in once the key stops being released automatically. The
# cmdlets above return a volume object whose default table shows the
# protector TYPES but not the password, and it cannot be read back
# from the recovery prompt itself.
PS> $rp = (Get-BitLockerVolume -MountPoint 'G:').KeyProtector | Where-Object KeyProtectorType -eq 'RecoveryPassword'
PS> $rp | Format-List KeyProtectorId, RecoveryPassword
# Domain- or Entra-joined? Escrow it centrally as well:
# Backup-BitLockerKeyProtector -MountPoint 'G:' -KeyProtectorId $rp.KeyProtectorId
# BackupToAAD-BitLockerKeyProtector -MountPoint 'G:' -KeyProtectorId $rp.KeyProtectorId
PS>} else {
PS> Write-Warning 'BitLocker is unavailable on this Windows edition.'
PS>}
⚠ Review before running — these commands run elevated and can change system settings, or require a reboot or maintenance window.