How to disable changing the system date/time programmatically using VB

Posted on 2006-04-17
Last Modified: 2011-10-03
Does anyone know how to disable the user from changing the system's date and time.  I know it can be done via policy, but I can't use that in this situation.  My program applies different rights to the system in real-time when the user logs into my program (but all the while only 1 user is logging in to Windows).  I can control almost everything about the system, but this one user right is giving me trouble.  I know how to refresh the policy once the registry has been changed, but I can't figure out which registry entries to change and to what.  Any help would be appreciated.  Thanks.
Question by:codeconqueror
    LVL 10

    Assisted Solution


    Ummm.. Interesting one - can't track down the appropriate registry entries either.. but, a couple of ways would be;

    1. Remove the Read permissions (or explicity deny access) for the user to the physical timedate.cpl applet itself using cacls.exe for instance.
    2. Rename the file!!

    hope that helps somewhat...
    LVL 26

    Expert Comment

    Have you check

    run gpedit.msc

    Local Computer Policy->Computer Configuraton->Windows Settings
    ->Security settings->local policies->user rights assignment

    change the system time
    LVL 5

    Author Comment

    eddykt -> I know I can via gpedit, but I need to do this programatically and with only 1 windows user.  They log in to windows, open my program and log into my program.  When they log into my program, I setup their Windows user rights based on the settings the admin entered into my software (no desktop, no date/time change, no start button, etc...).

    fostejo ->  I have tried to rename the file, but XP magically pulls it back.  I renamed it from TimeDate.cpl to and watched XP re-copy the file after about 20 seconds.

    Anyone have any other ideas?
    LVL 26

    Accepted Solution

    >>I renamed it from TimeDate.cpl to and watched XP re-copy the file after about 20 seconds.
    LVL 5

    Author Comment

    errr, not so big a fan of that one Eddykt.  I did figure out the following though (from


    [HKEY_CURRENT_USER\Control Panel\don't load]

    By making these changes, and disabling access to the control panel (I already had that in the program), I got the effect I wanted.  I'll just make the Date/Time right a sub-right of access control panel.  Thanks for your help guys.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Introduction While answering a recent question ( in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

    746 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

    13 Experts available now in Live!

    Get 1:1 Help Now