-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility for Windows 10/11 HOME editions #4
Comments
I've created PR (#5) for that but I expect some issues for example The program is being running as "system service/daemon" and The same situation with 'wmic COMPUTERSYSTEM GET USERNAME'. Please, can you check correctness of windows-home version by link |
Yeah, I was already kind of worried about that. Home edition sucks - but it is what most children will be running. I have seen a bunch of posts where parents are looking for a solution like yours who do not want to use the built in Family functionality which requires MS accounts. Maybe it requires to either Will test this tonight on a VM running Windows Home Edition and report back. PS: I see you already found a much better solution for the message box than the vbs method. Nice. |
Here come the results of my testing. The good news: The bad news: 'PowerShell -Command "Add-Type -AssemblyName PresentationFramework;[System.Windows.MessageBox]::Show('User will be killed in a few minutes')"' as picked up from the config works - but it will only show the message on the desktop of the user who is running parental-control-exe. I saw this in the above situation running the exe directly from another admin account: The user which would exceed the allotted time did not receive the message box. Instead the message box pops up at the user who runs the parental-control-exe process. Another observation: Until the message is confirmed by clicking "OK" the flag for message sent will not change to true. Also, the time counting stops for that user. |
Yeah, i've checked and I'm gona that |
Good catch! Thanks |
Hmmm, this crossed my mind too but I'm skeptical it can work: How to deal with the user password? Impersonation seems to be possible from a system service but extremely complex in Windows (it is made almost impossible by design for security and audit reasons - even the admin cannot impersonate a normal user). This is why I tried to shutdown the machine via 'shutdown /s'. While it is brutal it would be acceptable from my perspective. I do not understand why it did not work in my first attempt. One would think that the local system has the privilege to shutdown the local machine. However, there is another problem with running parental-control as a system service in Windows Home: Any interaction with the currently active user via UI like the message box will be impossible. Upon further reading I understood that system services run as session Id 0 in Windows, whereas all users run in sessions 1, 2, .. etc. It is impossible to interact from session 0 to any other session via UI - they are completely isolated. For that reason I added 'shutdown /s /t 60' as this creates a system wide pop up for any user announcing that the system will shut down in 60 seconds. One can even add a custom text by adding e.g. '/c "Time is Up!"'. But as stated above this did not yet work for some strange reason (maybe the service needs to be launched somehow differently to be allowed to do that). The other strategy would be to not run parental control as a service under Windows Home. Rather launch it as the current user upon logon (aka startup items). Then both 'shutdown /l' as well as the message box should work. |
gave it another test running under user account. As expected, logoff via 'shutdowjn /l' and message box both work. Should be straight forward as a startup item. I also tested that it can be started hidden with a vbs script: Set Shell = CreateObject("WScript.Shell") The only thing that is missing would be to have the message box sitting always on top (maybe something in the PowerShell command?) and the counting bug fixed, i.e. not waiting to confirm the message via ok button. From my point of view that would fit the bill for Windows Home. Obviously the system service is somewhat nicer and consistent with the Linux an Win Pro philosophy. But at least with my limited understanding I do not see a straight forward way under Home Edition. |
Thank you for sharing this tool! It looks perfect and works fine on Windows Pro/Enterprise Editions. For the latter I found one small issue in https://github.com/vasyaod/parental-control/blob/master/schedule-daemon/src/WindowsCommand.hs
The msg command requires '/TIME:10' rather than '/10'. At least on my test system the message would not be displayed otherwise.
A bigger problem would be Windows 10/11 HOME editions, which probably most children will run rather than a Pro or Enterprise Edition: The Windows commands 'query', 'msg' and 'logoff' do not exist in the HOME editions!
There may be ways to substitute them however. The substitutions should work with any edition of Windows, but are a little less powerful in that they only work with the current user (if multiple users are logged in the user with an active desktop is considered the current user):
Instead of 'query': Use 'wmic /node:localhost COMPUTERSYSTEM GET USERNAME'
Instead of 'logoff': Use 'shutdown /l'
Instead of 'msg': Use the vbs method shown here: https://superuser.com/questions/1278006/how-to-display-a-msgbox-directly-from-cmd. Message file can obviously be stored as part of the parental control as it is a static message
Any chance to make this work?
The text was updated successfully, but these errors were encountered: