【发布时间】:2020-05-04 20:37:41
【问题描述】:
我有一台装有 windows 10 操作系统的机器,这台机器没有加入域。我的位储物柜已启用。现在我想使用以下代码备份我的恢复密码:
$BLV = Get-BitLockerVolume -MountPoint $env:SystemDrive
$KeyProtectorID=""
foreach($keyProtector in $BLV.KeyProtector){
if($keyProtector.KeyProtectorType -eq "RecoveryPassword"){
$KeyProtectorID=$keyProtector.KeyProtectorId
break;
}
}
$result = BackupToAAD-BitLockerKeyProtector -MountPoint "$($env:SystemDrive)" -KeyProtectorId $KeyProtectorID
if($result){
return $true
}
if($Error){
return $false
}
return $false
我的问题是,为什么它没有显示任何错误并返回真值。虽然它应该显示错误或 $result 应该为空或 false,因为我的机器未加入域。为什么 $result 包含一个卷对象,而它应该显示任何错误或空结果。
【问题讨论】:
标签: powershell