如何在不重新启动的情况下通过命令行(脚本)隐藏“关机”和“注销”

本文关键字:隐藏 脚本 关机 注销 命令行 重新启动 情况下 | 更新日期: 2023-09-27 17:59:24

如何在不重新启动的情况下通过命令行(脚本)隐藏Windows 7中的"关机"answers"注销"按钮。

我在谷歌上搜索了如何通过gpedit.msc完成http://www.thewindowsclub.com/prevent-users-shutting-down-restarting-windows-computer

使用ntrights.exe的方法不起作用。

我很乐意接受任何解决方案批处理、powershell、c#等。

如何在不重新启动的情况下通过命令行(脚本)隐藏“关机”和“注销”

GPUpdate /force

尽管它会自动每小时发生一次。

我假设您不打算将其用于任何非法活动,对吧?

好的,这里有一个方法。

下载Process Monitor工具:https://technet.microsoft.com/en-us/library/bb896645.aspx

启动ProcMon.exe并对所需的组策略进行更改。

在ProcMon中查找更改后的注册表值,这样您就可以知道需要使用脚本/c#代码编辑哪些注册表值。

下面是一个如何使用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();
}