Thursday, February 7, 2019

windows 7 - How do I disable the Guest user from shutting down the PC while the Admin is logged in?



I'm running Windows 7 Ultimate. I found out how to disable the Guest user from shutting down at all, but then they can't shutdown even if Admin account is logged off.



Edit: To clarify a little, say I want to give my PC to someone, I usually click on Switch User and log in using the Guest account. That way, they can't access my account as it asks for a password. I want that in such a case, they shouldn't be able to shut down the PC as my admin account is still logged on.



However, if someone else boots up the PC themselves and uses the Guest account, then they should be able to shut it down too, as my Admin account hasn't been logged on.


Answer



Got my question answered here -





This is the correct method. It is also robust in that it is
unconditional. If you wish to have your cake and eat it then the Guest
account must use a powerful "agent" to perform the shutdown task. A
scheduled task would be such an agent. It could work like so:




  1. Create a scheduled task that runs Script1 to perform these tasks:

  2. Check if the file C:\Shutdown\Shutdown.txt exists.


  3. If it does not, exit from the script.

  4. If it does, delete Shutdown.txt.

  5. Check if there is a live Administrator session. If yes, exit from the script.

  6. If there is no live Administrator session, shut down the machine, using shutdown.exe.

  7. The task must run once every 3 minutes under an admin account.

  8. Create a desktop shortcut for the Guest user that invokes Script2 to perform these tasks:

  9. Check if there is a live Administrator session.

  10. If it does, create a pop-up to inform the user that the machine cannot be shut down.

  11. If it does not, create the file C:\Shutdown\Shutdown.txt. The scheduled task will "see" this file and will shut down the machine.




No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...