Solved

setting time under NT from non Administrator Accounting

Posted on 2000-03-09
6
202 Views
Last Modified: 2010-04-02
i need to set the sistem time without using NT Security (because my program will run on NT under non Admin login and it must have the possibility to set the system time!)

how can i do this?
and it's possible to do it?
(samples of source code are needed)

thanks

Cristian Bertoldi

i've posted the question under C section too. I will assign 500 points to the first correct answer.....
0
Comment
Question by:crisbert
  • 3
  • 2
6 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 2600576
This is possible by using an account that holds the 'SeSystemtimePrivilege' - there is no need to have an admin login. This privilege is usually granted to Administrators and Power Users, but can also be granted to 'normal' users, but granting privileges indeed needs an admin account (e.g. your installation program could do it).

If you could go this way, I could offer some samples.

Another alternative would be to use a service that sets the time, but this is much more work...
0
 

Author Comment

by:crisbert
ID: 2601704
ok , i'll try this way if you send me a sample...

thanks
0
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 2602000
http://msdn.microsoft.com/library/devprods/vs6/visualc/vcsample/vcsmpisaprivssample.htm

and download the sample. The 'lsaprivs.c' file illustrates how to do it. Simply replace

        Status = SetPrivilegeOnAccount(
                    PolicyHandle,           // policy handle
                    pSid,                   // SID to grant privilege
                    L"SeServiceLogonRight", // Unicode privilege
                    TRUE                    // enable the privilege
                    );

from the sample with

        Status = SetPrivilegeOnAccount(
                    PolicyHandle,           // policy handle
                    pSid,                   // SID to grant privilege
                    L"SeSystemtimePrivilege", // Unicode privilege
                    TRUE                    // enable the privilege
                    );

and it should work...
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 32

Expert Comment

by:jhance
ID: 2602079
This question is also asked at:

http://www.experts-exchange.com/jsp/qShow.jsp?ta=cprog&qid=10308047 

crisbert has said there that the option of changing user rights on the machine is not an option.  

An example to do this as a service is also included there.
0
 
LVL 86

Expert Comment

by:jkr
ID: 2602244
Sorry, didn't pay attention to this Q in the C area...
0
 

Author Comment

by:crisbert
ID: 2603779
thanks anyway, i'll use this sample code in another application....

if you have anything else......

Thanks
Cristian Bertoldi

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now