-
- :::: 限制用户更改系统时间 By FastSLZ 2009-6-1 CMD WinXP SP2 or WinXP SP3
- @echo off&SetLocal EnableDelayedExpansion
- set "SecPath=%WINDIR%\security\Database"
- cd.>"%SecPath%\sec.cfg"
- if not exist "%SecPath%\sec.bak" secedit /export /cfg "%SecPath%\sec.bak" /quiet
- for /f "delims=" %%i in ('type "%SecPath%\sec.bak"') do (
- set "var=%%i"
- if "!var:~0,21!"=="SeSystemtimePrivilege" (>>"%SecPath%\sec.cfg" echo SeSystemtimePrivilege =) else >>"%SecPath%\sec.cfg" echo/!var!
- )
- secedit /configure /db "%SecPath%\sec.sdb" /cfg "%SecPath%\sec.cfg" /quiet
- gpupdate /force >nul
- echo 重启生效!&pause>nul
复制代码 其它本地安全策略可以参考此代码-
- @echo off
- ::::还原系统时间可更改状态
- secedit /configure /db "%SecPath%\sec.sdb" /cfg "%SecPath%\sec.bak" /quiet
- gpupdate /force >nul
- echo 重启生效!&pause>nul
复制代码
|