使用PowerShell激活外部驱动器上的Bitlocker

问题描述 投票:1回答:1

我正试图通过PowerShell和bitlocker加密外部驱动器。

我在这里发布的脚本将是一个更大的设置的一部分,其中所有连接到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

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

在bitlocking时是不是都可以使用密码和recoverykey动作?

提前致谢

powershell bitlocker
1个回答
1
投票

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

来自TechNet:“启用加密时,只能指定其中一种方法或组合,但可以使用Add-BitLockerKeyProtector cmdlet添加其他保护程序。”

所以在启用后使用Add-BitLockerKeyProtector

© www.soinside.com 2019 - 2024. All rights reserved.