c# - 使用 C# 从 Microsoft.GroupPolicy.GPTrustee 获取名称/Sid
问题描述
我正在尝试使用C# 中的 Get-GPPermission cmdlet 获取应用于组策略对象的权限。(不使用 Microsoft.GroupPolicy 命名空间)我能够获取权限类型和继承属性的值,但无法获取受托人的名称或 Sid .
下面是代码片段:
Type gpTrusteeType = obj.Members["Trustee"].Value.GetType();
object gpTrustee = Activator.CreateInstance(gpTrusteeType);
gpTrustee = obj.Members["Trustee"].Value;
PropertyInfo name = gpTrusteeType.GetProperty("Name");
String trusteeName = name.GetValue(gpTrustee, null).ToSring();
错误消息:没有为此对象定义无参数构造函数。
尝试使用 ConstructorInfo,但没有帮助
解决方案
推荐阅读
- r - Rcpp:如何在 rcpp 函数中将“NULL”传递给“NumericMatrix”
- sql - SQL 中的 SELECT 语句用于过滤掉多个条目
- pepper - 当没有可用的 LAN 电缆时,将 Pepper aldebaran 机器人连接到 wifi
- sql - 根据条件更新多列
- python - 为什么 python 和 whereis python 返回不同的值?
- c# - 如何在 Dot net core 2.1 中创建 SecurityBindingElement
- php - 公司内网使用Apache/PHP/PostgreSQL,想切换到Node.js
- reactjs - setState 不合并而是替换
- c# - EditText Xamarin Android 键盘未显示
- javascript - 获取文件名并保存在var中