c# - 通过 SID 解析显示用户名的最佳方法?

标签 c# windows sid

我从注册表中读取了 SID 列表,HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

在给定 C# 中的 SID 字符串的情况下,如何解析显示用户名(例如 DOMAIN\userBUILT-IN\user)?

最佳答案

刚在 pinvoke.net 上找到它.

替代托管 API: 在 .Net 2.0 中可用:

using System.Security.Principal;

// convert the user sid to a domain\name
string account = new SecurityIdentifier(stringSid).Translate(typeof(NTAccount)).ToString();

关于c# - 通过 SID 解析显示用户名的最佳方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/380031/

相关文章:

c# - 使用 C# .NET Core 3 使用 SSL 证书连接到 MySQL 数据库

c# - 字典<整数,列表<字符串>>

windows - 如何在不编写自己的程序的情况下将某些文件上传到 Azure Blob 存储?

c# - 您要在 C# 中获取 Windows 安装 SID 吗?

c# - Linq 查询中的“IN”和 'NOT IN'

windows - Windows 7 上的 SQL Server 2005 企业版

java - 我得到 "file not found: example.java"并将我的文件放在 jre/bin 中

database - Oracle 数据库多实例配置

c++ - 在没有管理员权限的情况下获取主域 SID

c# - CheckboxList 未在 JavaScript 中获取选定值