简体   繁体   English

Powershell ADSI ntSecurityDescriptor

[英]Powershell ADSI ntSecurityDescriptor

Hi I'm having some trouble getting the information on who joined the computer to the domain. 嗨,我在获取有关谁将计算机加入域的信息时遇到了一些麻烦。 I can use this code but this is to be used by some non-administrative users that dont have access to the Powershell ActiveDirectory module. 我可以使用此代码,但是某些无法访问Powershell ActiveDirectory模块的非管理用户可以使用此代码。

Get-ADComputer myComputer -Properties ntSecurityDescriptor | Select ntSecurityDescriptor -ExpandProperty ntSecurityDescriptor

It's the owner property I am interested in here. 这是我对此感兴趣的所有者财产。 But now to the real deal I need to make it work with ADSI 但现在真正的交易是,我需要使其与ADSI一起使用

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

How do I "expand" the properties of the nTSecurityDescriptor using ADSI? 如何使用ADSI“扩展” nTSecurityDescriptor的属性?

Powershell is smart enough that it will try to show you the best representation of an object with the most common properties it thinks you will need. Powershell足够聪明,它会尝试向您展示具有所需的最常见属性的对象的最佳表示。 Sometimes though you need to get the raw object underneath which you can do by using the PSBase property. 有时,尽管您需要获取原始对象,但您可以使用PSBase属性在其下进行操作。 Here's a link to Jeffrey Snover talking about it. 这是有关Jeffrey Snover链接 Try this 尝试这个

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM