1

对 Powershell 来说相当新,我设法获得以下代码来检索域中计算机的 Bitlocker 密钥,但是,我有一个问题:

Clear-Host
$TestOU = "OU=ABC,DC=XYZ,DC=com"
$PCs = Get-ADComputer -Filter * -SearchBase $TestOU
$Results = ForEach ($Computer in $PCs)
{
New-Object PSObject -Property @{
ComputerName = $Computer.Name
RecoveryPassword = Get-ADObject -Filter 'objectclass -eq "msFVE- 
RecoveryInformation"' -SearchBase $computer.DistinguishedName -Properties 
msFVE-RecoveryPassword,whencreated | sort whencreated -Descending | select 
msfve-recoverypassword
}
}
$Results

我的每个密码的输出都以 {a{msfve-recoverypassword= 开头,我不确定如何删除它。

4

1 回答 1

0

以下代码为 shell 中的人类消费提供了有用的输出,但也可以在脚本中使用:

$computer = Get-ADComputer $computerName
Get-ADObject -Filter 'objectClass -eq "msFVE-RecoveryInformation"' -SearchBase $computer.DistinguishedName -Properties whenCreated, msFVE-RecoveryPassword | `
  Sort whenCreated -Descending | Select whenCreated, msFVE-RecoveryPassword
于 2019-03-07T11:20:33.053 回答