【发布时间】:2018-02-12 11:11:09
【问题描述】:
我正在尝试通过带有 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之前或之后使用Add-BitLockerKeyProtector。此外,在调用Enable-BitLockerAutoUnlock之前,您无需等待FullyEncrypted状态。 -
如你所见(甚至在我编辑之前)我已经等待完全加密状态
-
我说你确实不需要需要等待。即使在卷上启用 BitLocker 之前,您也可以致电
Add-BitLockerKeyProtector。
标签: powershell bitlocker