banner
Windows GroupPolicy Scripts

「草稿」 Windows 开关机脚本

Scroll down

Introduction

文件位置

C:\Windows\System32\GroupPolicy\
├── Machine\
│   └── Scripts\
│       ├── psscripts.ini
│       ├── scripts.ini
│       ├── Shutdown\
│       └── Startup\
└── User\
    └── Scripts\
        ├── Logoff\
        └── Logon\

文件格式

scripts.ini

bat 脚本描述文件

# 关机运行
[Shutdown]
0CmdLine=script_1.bat
0Parameters=
1CmdLine=script_2.bat
1Parameters=

# 开机运行
[Startup]
0CmdLine=script_3.bat
0Parameters=

psscripts.ini

PowerShell 脚本描述文件

# 优先运行
[ScriptsConfig]
EndExecutePSFirst=true

# 关机运行
[Shutdown]
0CmdLine=script_1.ps1
0Parameters=
1CmdLine=script_2.ps1
1Parameters=

# 关机运行
[Startup]
0CmdLine=script_3.ps1
0Parameters=

Other

Bootstrap.bat

@echo off
for /f %%i in ('dir /s /b *.ps1') do (
    powershell -noprofile -nologo -executionpolicy bypass -File %%i
)

EnableProxy.ps1

Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" ProxyEnable -Value 1
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" ProxyServer -Value "127.0.0.1:8080"

DisableProxy.ps1

Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" ProxyEnable -Value 0
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" ProxyServer -Value ""

我很可爱,请给我钱

其他文章
cover
ESP-IDF 最小项目
  • 2023/03/27
  • 20:52
  • ESP32C3
请输入关键词进行搜索