![](/img/trans.png)
[英]Search for a Local user in a local group that does not have Foreign Security policy
[英]Add user to local security policy on Windows Server 2012
使用LSA功能特权和模拟中的代码时
在Windows Server 2008R2上,可以很好地将用户添加到登录即服务策略中。 在Windows Server 2012上使用此代码时,它将不起作用。 函数“ LsaAddAccountRights”返回一个奇怪的数字,该数字无法通过“ LsaNtStatusToWinError”转换为Windows错误。 返回代码类似于1034061105409818720。每次运行相同的代码时,它都会返回不同的数字。 有人会因为我被卡住而提供帮助吗?
使用的初始语句为:_私有共享函数LsaAddAccountRights(PolicyHandle为IntPtr,AccountSid为IntPtr,UserRights为LSA_UNICODE_STRING(),CountOfRights为长)作为长端函数
解决方案是将结果类型更改为UInt32。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.