当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] PowerShell 获取 AdComputer BitLocker 密钥

作者:精品下载站 日期:2024-12-14 17:04:22 浏览:14 分类:玩电脑

PowerShell 获取 AdComputer BitLocker 密钥


PowerShell 中的 Get-AdComputer 命令用于获取活动目录计算机。它使用包含完整卷加密密码的类 msFVE-RecoveryInformation 并使用属性 msFVE-RecoveryPassword 来获取 adcomputer BitLocker 密钥。

ms-FVE-RecoveryPassword 属性存储恢复 Full Volumne 加密卷所需的密码。

在本文中,我们将讨论如何使用 PowerShell 从广告获取广告计算机 BitLocker 恢复密钥。

获取 ADComputer BitLocker 恢复密钥和名称

使用 PowerShell 中的 Get-AdComputer cmdlet 检索 Active Directory 中的计算机,并将计算机信息传递给 msFVE-RecoveryInformation 类以获取恢复密钥。

# Get the adcomputer
$comp = Get-ADComputer ENGG-PRO

# Get the distinguished name of the computer
$dn = $comp.DistinguishedName

# Create LDAP path
$ldPath = "AD:\",$dn -join ""

# get object that contains Full Volume encryption password
$ldObj = Get-ChildItem $ldPath | where {$_.objectClass -eq "msFVE-RecoveryInformation"}

# Create LDAP path
$ldObj = "AD:\",$ldObj.distinguishedName -join ""

# Use the attribute msFVE-RecoveryPassword
$pass = Get-Item $ldObj -properties "msFVE-RecoveryPassword"

# Get the bitlocker recovery for adcomputer
$recoveryPassword = $pass.'msFVE-RecoveryPassword'

# Get the computer name
$computerName = $comp.Name

在上面的 PowerShell 脚本中,Get-AdComputer cmdlet 从活动目录中检索计算机详细信息。使用 msFVE-RecoveryInformation 类,它获取一个存储完整卷加密密码的对象。

msFVE-RecoveryPassword 属性用于获取活动目录 (AD) 中计算机的 BitLocker 密钥以及使用 $comp.name 的计算机名称。

上述 PowerShell 脚本的输出导致获取 adcomputer bitlocker 密钥和计算机名称。

结论

我希望上述有关如何使用 PowerShell 中的 Get-AdComputer cmdlet 获取 adcomputer bitlocker 恢复密钥及其名称的文章对您有所帮助。

Get-AdComputer -Filter * 检索活动目录中的所有计算机。如果活动目录太大,可能会导致超时问题。因此,请使用 SearchBase 参数来限制 OU 内计算机的搜索。

您可以在 ShellGeek 主页上找到有关 PowerShell Active Directory 命令和 PowerShell 基础知识的更多主题。

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯