get machine SID (including primary domain controller)

前端 未结 1 1332
渐次进展
渐次进展 2021-01-03 01:09

I need to get machine SID (not computer account\'s SID) in C#. Computer is specified be host name, it is\'t necessarily local computer and it can be domain computer or workg

相关标签:
1条回答
  • 2021-01-03 01:49

    It appears that for most computers you do the following:

    LookupAccountName("", "ComputerName", ...); ConvertSidToStringSid(...)

    But for domain controllers you have to add a dollar sign to the computer name parameter, and then delete the last segment in the returned SID.

    0 讨论(0)
提交回复
热议问题