473,811 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Urgent: Adding users to log on locally list programmaticall y using C#

Does anyone know how to add users to the log on locally list in User
Rights Management inside Local Security settings.

Thanks

May 4 '07 #1
12 5345
Your question really has little to do with C# programming (that's the subject
of this group) but here goes:

open Local Security Settings from Administrative Tools, Computer Management
in Control Panel.

open the User Rights Assigment tree node.

Find the Log on Locally item in the Policy (right) window.

Double-click on this, and you can then add users or groups.

Next time, try to post to the relevant newsgroup. You're more likely to get
help.

--Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"ab************ @gmail.com" wrote:
Does anyone know how to add users to the log on locally list in User
Rights Management inside Local Security settings.

Thanks

May 4 '07 #2
My apologies, you did say "programmatical ly". need to find the appropriate
WMI class to do this. For that, I can't help.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"ab************ @gmail.com" wrote:
Does anyone know how to add users to the log on locally list in User
Rights Management inside Local Security settings.

Thanks

May 4 '07 #3
<ab************ @gmail.comwrote in message
news:11******** **************@ n76g2000hsh.goo glegroups.com.. .
Does anyone know how to add users to the log on locally list in User
Rights Management inside Local Security settings.

Thanks

All members of the "users", "administrators " and "guest" groups are
automatically allowed to log on locally. What other users were you thinking
off?

Willy.
May 4 '07 #4
well. I am required to create a function that automates the following

start -settings -control panel -administrative tools -local
security policy -user assignment rights -find 'log on
locally' (open up properties) -add users or workgroups to that list.

hope that makes my question clear.

thanks

May 7 '07 #5
Oh and I had test users in mind, so basically - "testuser1" for
example.
May 7 '07 #6
<ab************ @gmail.comwrote in message
news:11******** ************@n5 9g2000hsh.googl egroups.com...
Oh and I had test users in mind, so basically - "testuser1" for
example.


Well, actually there is nothing in the Framework that helps you with this.
So you will have to call into some WIn32 LSA API's using PInvoke.
Basically what you need to do is:
1. Get a LSA Policy handle for the target system, by calling LsaOpenPolicy.
2. Get the SID of the user account, by calling LsaLookupNames2
3. Add the "SeInteractiveL ogonRight" for the account, by means of a call to
LsaAddAccountRi ghts.
Note that LSA_UNICODE_STR ING type as used in these API's is not a CLR
string, it's a structure you need to initialize correctly before you call
the API's, watch out!.

But again, before you can grant this privilege to an account, the account
MUST exist, why not simply create the account and make it a member of the
"users" group or a group which already has the "Allow Logon Locally"
privilege"?

Willy.
May 8 '07 #7
Thanks for the response Willy.

My initial plan was to add the user to a workgroup that was pre-
existing in the list, but then those workgroups might have privleges
which I would not want the users I create to have.
May 8 '07 #8
<ab************ @gmail.comwrote in message
news:11******** ************@o5 g2000hsb.google groups.com...
Thanks for the response Willy.

My initial plan was to add the user to a workgroup that was pre-
existing in the list, but then those workgroups might have privleges
which I would not want the users I create to have.

But you are talking about local accounts, I don't think you have tens of
these on a local machine don't you?
If you are running in a Windows domain, you can achieve what you want by
applying Group Policy Management.

Willy.

May 8 '07 #9
On May 8, 6:29 am, "Willy Denoyette [MVP]"
<willy.denoye.. .@telenet.bewro te:
<abhishek.gi... @gmail.comwrote in message

news:11******** ************@n5 9g2000hsh.googl egroups.com...
Oh and I had testusersin mind, so basically - "testuser1" for
example.

Well, actually there is nothing in the Framework that helps you with this.
So you will have to call into some WIn32 LSA API's using PInvoke.
Basically what you need to do is:
1. Get a LSA Policy handle for the target system, by calling LsaOpenPolicy.
2. Get the SID of the user account, by calling LsaLookupNames2
3. Add the "SeInteractiveL ogonRight" for the account, by means of a call to
LsaAddAccountRi ghts.
Note that LSA_UNICODE_STR ING type as used in these API's is not a CLR
string, it's a structure you need to initialize correctly before you call
the API's, watch out!.

But again, before you can grant this privilege to an account, the account
MUST exist, why not simply create the account and make it a member of the
"users" group or a group which already has the "Allow Logon Locally"
privilege"?

Willy.

I did that and it says -- "specified privilege does not exist" for
"SeInteractiveL ogonRight"

May 8 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2075
by: Jonathan Trevor | last post by:
Hi, Spent nearly 8 hours googling and trying code on this yesterday without much success. I'd like to write a .NET application (using .NET primitives, older Win32 calls, or WMI etc) to work out which users can log onto a machine the application is running on. The platforms I'd like to support are NT/2000/XP - although 98 would be good too. It looks like for 2000 and XP OS' the answer is listed in the "Local Security Policy" control...
4
3650
by: CGuy | last post by:
Hi, I have an ASPX page which has a datagrid and this datagrid is bound to a Custom Collection. sample code this.DataGrid1.DataSource = UserManager.Users; this.DataGrid1.DataBind();
9
10912
by: Ben Dewey | last post by:
Project: ---------------------------- I am creating a HTTPS File Transfer App using ASP.NET and C#. I am utilizing ActiveDirectory and windows security to manage the permissions. Why reinvent the wheel, right? Everything so far is working well with the Active Directory. The problem I am having is with adding File Permissions to a directory. I am currently using some code courtesy of "Willy Denoyette "
3
4889
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that the best method? Do you have a sample of how to do this?
3
13181
by: enilno | last post by:
I'm working on a C# app., and I need to programmatically add a local user to a local group on the computer on which the app. is running. When end-users run this app., they will be logged on as local Administrator (so they should have sufficient permissions). Would any one out there know how to programmatically add a local user to a local group in C#? TIA
3
3681
by: Prash | last post by:
IIS serving javascript files, gives me error 4/21/2006 6:48 AM Guys/Gals, I am using IIS as a server to serve the javascript files. But it is giving me the error as "Object doesn't support this property or Method". I have modified the plugin-cfg.xml, to discard the entries of js files. Also, i checked to insure that the .js extension is added to the IIS mime type list by adding a mime type for .js as IIS6 will not serve up
2
15078
by: ChrisCicc | last post by:
Hi All, I got a real doozy here. I have read hundreds upon hundreds of forum posts and found numerous others who have replicated this problem, but have yet to find a solution. Through testing I have been able to find the cause of the problem, and will describe it here first textually and then through a code example. The purpose of what I am trying to do is to create a postback-free web application through the use of ASP.net AJAX UpdatePanels...
3
2173
by: jyothi.priya143 | last post by:
Hi Friends, Urgent Requirement for GENPACT is here for u now... Here u can upload a soft copy of ur resume in one click... Here U can also get Jobs-Freshers & Experienced, Sample Resumes, Testing Tutorials, Testing Advices, FAQs, Placement Papers etc., I think this will be helpful to you to develop your career and searching Job easily in Software Testing. Hurry Up..!!..!! All the Best... Have a Nice Day...
0
9728
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10648
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10389
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10135
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9205
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5554
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4339
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3867
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.