How do I prevent a user from changing the system date / time (in Windows 7)?

When using googled, the general advice is to create a standard account without an administrator.

I just tried this. I only had one account, my own, which is an administrator, and then created a second one (not a guest account). I logged out of my account and into a new one and tried to change the time. On Windows 7 a window popped up asking if my main account allows (and prompts for a password).

I was told, "Can't change system date / time." I intended to provide a PC with just a regular account and with s / w, but can't (I think) prevent the user from creating an administrative account and changing the date / time.

Can I prevent this programmatically from Delphi, or should I just say that if the user wants to be destructive, I cannot prevent it?


source to share

2 answers

In your application, you can actually determine when the system changes while your application is running.

When you change the system time, you will get WM_TIMECHANGE.

On startup, you can save gettickcount (as StartTickCount) and now (as StartTime). When checking, you can check if they differ between tickkat and different time values ​​(allow slight discrepancy) and know different. However, if the user changes the system time away from your application, this trick will not work. You may have a service that automatically checks for this.

If you need to go back to the original time, here are some resources: CHANGE SYSTEM TIME

btw, at the OS level, a regular user cannot create an admin user.



Typically such restrictions are set using Windows Group Policy

enter image description here

From delphi you can use Group Policy API or RSoP WMI Classes .



All Articles