Powershell ADSI ntSecurityDescriptor

Powershell ADSI ntSecurityDescriptor,powershell,active-directory,adsi,powershell-ise,Powershell,Active Directory,Adsi,Powershell Ise,嗨,我在获取谁将计算机加入域的信息时遇到一些问题。 我可以使用此代码,但这将由一些无权访问Powershell ActiveDirectory模块的非管理用户使用 Get-ADComputer myComputer -Properties ntSecurityDescriptor | Select ntSecurityDescriptor -ExpandProperty ntSecurityDescriptor 这是我感兴趣的所有者财产。 但现在来谈谈真正的交易 我需要和ADSI一起工作 $C

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

Get-ADComputer myComputer -Properties ntSecurityDescriptor | Select ntSecurityDescriptor -ExpandProperty ntSecurityDescriptor
这是我感兴趣的所有者财产。 但现在来谈谈真正的交易 我需要和ADSI一起工作

$Computer = [ADSI](([ADSISearcher]"(name=myComputer)").FindOne().Path)
$Computer.nTSecurityDescriptor
System.__ComObject

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

Powershell非常智能,它将尝试使用它认为您需要的最常见属性向您展示对象的最佳表示。有时,您需要获取原始对象,通过使用PSBase属性可以在其下执行此操作。下面是一个关于它的讨论。试试这个

$Computer = [ADSI](([ADSISearcher]"(name=myComputer)").FindOne().Path)
$Computer.PsBase.ObjectSecurity.Owner

Powershell足够智能,它将尝试向您展示对象的最佳表示形式,以及它认为您将需要的最常见属性。有时,您需要获取原始对象,通过使用PSBase属性可以在其下执行此操作。下面是一个关于它的讨论。试试这个

$Computer = [ADSI](([ADSISearcher]"(name=myComputer)").FindOne().Path)
$Computer.PsBase.ObjectSecurity.Owner

非常感谢。这解决了我的问题,我不知道我怎么可能错过ObjectSecurity属性时,摆弄与psbase:)谢谢!这解决了我的问题,我不知道在使用psbase时,我怎么会错过ObjectSecurity属性:)