【问题标题】:Powershell ADSI ntSecurityDescriptorPowershell ADSI ntSecurityDescriptor
【发布时间】:2014-06-16 16:29:17
【问题描述】:

您好,我在获取有关谁将计算机加入域的信息时遇到了一些问题。 我可以使用此代码,但它仅供一些无权访问 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 active-directory adsi powershell-ise


    【解决方案1】:

    Powershell 足够聪明,它会尝试用它认为你需要的最常见属性向你展示对象的最佳表示。有时虽然您需要获取原始对象,但您可以使用 PSBase 属性在其下进行操作。这是link to Jeffrey Snover 在谈论它。试试这个

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

    【讨论】:

    • 谢谢!这解决了我的问题,我不知道在摆弄 psbase 时我怎么会错过 ObjectSecurity 属性:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-30
    • 1970-01-01
    相关资源
    最近更新 更多