使用 powershell 在外部驱动器上激活 Bitlocker

Activate Bitlocker on external drive with powershell

我正在尝试使用 bitlocker 通过 powershell 加密外部驱动器。

我在此处发布的脚本将是更大设置的一部分,其中所有连接到 PC 的磁盘都将自动格式化,然后在其上启用 Bitlocker。 我正在尝试设置用于解锁卷的密码 导出恢复密钥以防最坏的情况发生...

代码:

$Pass = 'xxxxx.' | ConvertTo-SecureString -AsPlainText -Force
Enable-BitLocker -MountPoint "E:" -EncryptionMethod Aes256  -UsedSpaceOnly -PasswordProtector -Password $Pass 
Add-BitLockerKeyProtector -MountPoint "E:" -RecoveryKeyPath "D:\keys\" -RecoveryKeyProtector

do 
{
$Volume = Get-BitLockerVolume -MountPoint E:
Write-Progress -Activity "Encrypting volume $($Volume.MountPoint)" -Status "Encryption Progress:" -PercentComplete $Volume.EncryptionPercentage
Start-Sleep -Seconds 1
}
until ($Volume.VolumeStatus -eq 'FullyEncrypted')

Write-Progress -Activity "Encrypting volume $($Volume.MountPoint)" -Status "Encryption Progress:" -Completed

我收到一个错误:无法使用指定的命名参数解析参数集。

位锁时不能同时使用密码和恢复密钥操作吗?

提前致谢

调用 Enable-BitLocker 时不能同时使用密码和恢复密钥。

来自 TechNet:"You can specify only one of these methods or combinations when you enable encryption, but you can use the Add-BitLockerKeyProtector cmdlet to add other protectors."

所以启用后使用Add-BitLockerKeyProtector