简体   繁体   English

在Windows Server 2012上将用户添加到本地安全策略

[英]Add user to local security policy on Windows Server 2012

When using the code from LSA Functions Privileges and Impersonation 使用LSA功能特权和模拟中的代码时

on Windows Server 2008R2 it works fine to add a user to the logon as a service policy. 在Windows Server 2008R2上,可以很好地将用户添加到登录即服务策略中。 When using this code on Windows Server 2012 it doesn't work. 在Windows Server 2012上使用此代码时,它将不起作用。 The function 'LsaAddAccountRights' returns an strange number which can't be translated via 'LsaNtStatusToWinError' to a windows error. 函数“ LsaAddAccountRights”返回一个奇怪的数字,该数字无法通过“ LsaNtStatusToWinError”转换为Windows错误。 The return code is something like 1034061105409818720. Every time when I run the same code, it returns a different number. 返回代码类似于1034061105409818720。每次运行相同的代码时,它都会返回不同的数字。 Can someone provide some help because I'm stuck? 有人会因为我被卡住而提供帮助吗?

The initial statement used was: _ Private Shared Function LsaAddAccountRights(PolicyHandle As IntPtr, AccountSid As IntPtr, UserRights As LSA_UNICODE_STRING(), CountOfRights As Long) As long End Function 使用的初始语句为:_私有共享函数LsaAddAccountRights(PolicyHandle为IntPtr,AccountSid为IntPtr,UserRights为LSA_UNICODE_STRING(),CountOfRights为长)作为长端函数

The solution was changing the result type into UInt32. 解决方案是将结果类型更改为UInt32。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在没有外部安全策略的本地组中搜索本地用户 - Search for a Local user in a local group that does not have Foreign Security policy 阅读本地安全策略 - Reading local security policy SMTP代码在本地Windows中发送电子邮件,但不在Windows Server 2012中发送电子邮件 - SMTP Code Is Sending Email In Local Windows But Not In Windows Server 2012 用户定义函数的SQL Server 2012安全问题 - Security issues on user defined functions for Sql server 2012 Active Directory中的用户身份验证-Windows Server 2012 R2 - User Authentication in Active Directory - Windows Server 2012 R2 网络服务用户无法读取证书Windows Server 2012 - NETWORK SERVICE user cannot read certificate windows server 2012 MediaPlayer Windows Server 2012 - MediaPlayer Windows Server 2012 如何使用.NET更改本地安全策略 - How to Change Local Security Policy using .NET 如何使Windows用户具有集成安全性访问SQL Server? - How to make windows user has access to sql server with integrated security? 如何使用InstallShield LE为带有SQL Server 2012本地数据库的Visual Studio 2012 Windows窗体应用程序创建setup.exe文件 - How to create a setup.exe file using InstallShield LE for a Visual Studio 2012 Windows Forms Application with SQL Server 2012 Local Database
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM