【问题标题】:Get Non Pre-Windows 2000 Group Name from SID从 SID 获取非 Pre-Windows 2000 组名
【发布时间】:2017-12-07 05:38:08
【问题描述】:

我有一个代表不同域上的组的 SID。

我正在尝试使用以下方法获取组名:

$objSid = New-Object 'System.Security.Principal.SecurityIdentifier'($Sid)
$objUser = $objSid.Translate([System.Security.Principal.NTAccount])
$groupName = $objUser.Value

但是,这会返回与实际组名不同的 Windows 2000 之前的名称(前面有 A_)。

如何获得真正的组名而不是 Windows 2000 之前的组名?

编辑: iRon 提到我可以使用(Get-ADGroup $GroupName).Name,但是我现在需要用 C# 编写它。第一部分很容易翻译,但是如何获得 Get-ADGroup 命令行开关的 C# 代码?

【问题讨论】:

  • (Get-ADGroup $GroupName).Name
  • 感谢 iRon。你知道如何在 C# 中做到这一点吗?

标签: c# active-directory


【解决方案1】:

原来 Windows 2000 之前的名称只是 samAccountName。 因此,要获取组名,您只需搜索 samAccountName = pre-Windows 2000 名称的组。 这可以在 C# 中使用 DirectorySearcher 轻松完成。

【讨论】:

    猜你喜欢
    • 2012-10-22
    • 2014-08-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-12
    • 1970-01-01
    • 2017-05-12
    • 2011-10-13
    相关资源
    最近更新 更多