Powershell ADSI ntSecurityDescriptor

use*_*999 1 powershell adsi active-directory powershell-ise

您好,我在获取有关谁将计算机加入域的信息时遇到一些问题。我可以使用此代码,但这是供某些无权访问 Powershell ActiveDirectory 模块的非管理用户使用的。

Get-ADComputer myComputer -Properties ntSecurityDescriptor | Select ntSecurityDescriptor -ExpandProperty ntSecurityDescriptor
Run Code Online (Sandbox Code Playgroud)

这是我感兴趣的业主财产。但现在我需要让它与 ADSI 一起工作

$Computer = [ADSI](([ADSISearcher]"(name=myComputer)").FindOne().Path)
$Computer.nTSecurityDescriptor
System.__ComObject
Run Code Online (Sandbox Code Playgroud)

如何使用 ADSI“扩展”nTSecurityDescriptor 的属性?

Ste*_*enP 5

Powershell 足够智能,它会尝试向您展示对象的最佳表示形式以及它认为您需要的最常见属性。有时,您需要获取原始对象,您可以使用 PSBase 属性来获取原始对象。这是Jeffrey Snover谈论它的链接。尝试这个

$Computer = [ADSI](([ADSISearcher]"(name=myComputer)").FindOne().Path)
$Computer.PsBase.ObjectSecurity.Owner
Run Code Online (Sandbox Code Playgroud)