How to hide Shut Down and Log Off through commandline(script) without reboot

143 views Asked by At

How to hide Shut Down and Log Off buttons in Windows 7 through commandline(script) without reboot.

I've googled how it can be done through gpedit.msc http://www.thewindowsclub.com/prevent-users-shutting-down-restarting-windows-computer

Method with ntrights.exe wont work.

I'll glad to any solutions batch, powershell, c# etc.

2

There are 2 answers

0
user5032396 On BEST ANSWER
GPUpdate /force

Although it will happen every hour automatically.

0
F.H. On

I am assuming you do not intend to use it for anything illegal, right?

Ok here's an approach.

Download Process Monitor tool: https://technet.microsoft.com/en-us/library/bb896645.aspx

Start ProcMon.exe and make the changes on the needed group policies.

Find the changed registry values in ProcMon so you know which registry values you need to edit with the script/c# code.

Here is a little example of how to edit registry values with c#:

RegistryKey regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Policies\\Microsoft\\Windows\\", true);

if (regKey != null)
{
// create a registry subkey
regKey = regKey.CreateSubKey("Appx");
// create a dword
regKey.SetValue("AllowAllTrustedApps", "1", RegistryValueKind.DWord);
regKey.Close();
}