Tools/GroupPolicy_import_export_cn.bat

148 lines
4 KiB
Batchfile
Raw Normal View History

2018-10-22 23:37:36 +08:00
@echo off
::<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
color DE
echo <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>...
net session >nul 2>&1
if %errorLevel% == 0 (
goto continue
) else (
echo,
echo <20><><EFBFBD>Թ<EFBFBD><D4B9><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>иýű<C3BD><C5B1><EFBFBD>
echo <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>...
pause > nul
exit
)
:continue
::<3A><><EFBFBD><EFBFBD><EFBFBD>ӳٱ<D3B3><D9B1><EFBFBD>
SetLocal EnableDelayedExpansion
::<3A><>ȡϵͳ<CFB5>
for /f "tokens=1* delims=[" %%a in ('ver') do (
set b=%%b
)
::<3A><><EFBFBD><EFBFBD><E6B1BE>Ϣ<EFBFBD><CFA2>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>b
set b=%b:* =%
::<3A><><EFBFBD><EFBFBD>ϵͳ<CFB5><EFBFBD><E6B1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
for /f "tokens=1,3 delims=*." %%a in ("%b%") do (
set ver1=!ver1!_%%a
set ver3=!ver3!_%%b
)
for /f "tokens=2 delims=*." %%a in ("%b%") do (
set ver2=!ver2!_%%a
)
set version=!ver1!!ver2!!ver3!
:: <20><><EFBFBD><EFBFBD>
set db_name=%set
set gp_name="%UserProfile%\Desktop\gp_config%version%\%db_name%.inf"
set gp_folder="%UserProfile%\Desktop\gp_config%version%\"
set gp_file="%Windir%\System32\GroupPolicy"
set gp_export_file="%UserProfile%\Desktop\GroupPolicy"
set logs="%WinDir%\security\logs\scesetup.log"
echo,
echo <20><>____<5F><5F>
echo (<28><><EFBFBD>ء<EFBFBD>)<29>ĩ<EFBFBD> <20><>..*<2A><>
echo <20><> <20><>
echo * * * <20><>ӭ<EFBFBD><D3AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Թ<EFBFBD><D4B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> copyright by Molly Lau * * *
echo * <20><><EFBFBD>`<60>`<60><> *
echo * *
echo * ʹ<><CAB9><EFBFBD><EFBFBD>֪<EFBFBD><D6AA> *
echo * *
echo * <20><> ֻ֧<D6BB>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1>ű<EFBFBD>Ԥ<EFBFBD>ȵ<EFBFBD><C8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD> *
echo * <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ϵͳ<CFB5>ڲ<EFBFBD><DAB2><EFBFBD><E6B1BE><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD>Ӧ *
echo * <20><> <20><>֧<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>뵱ǰ<EBB5B1>汾ϵͳ<CFB5><CDB3>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD> *
echo * <20><> <20><><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>̲<EFBFBD><CCB2><EFBFBD><EFBFBD><EFBFBD><E6A3AC><EFBFBD><EFBFBD>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
echo * <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><D6A7><EFBFBD><EFBFBD><EFBFBD>¹<EFBFBD><C2B9>ܣ<EFBFBD> *
echo * *
echo * 1. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
echo * *
echo * 2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
echo * *
echo * <20>س<EFBFBD><D8B3><EFBFBD><EFBFBD>˳<EFBFBD> *
echo * *
echo * *
echo * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
echo,
set /p ask1=<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>IJ<EFBFBD><EFBFBD><EFBFBD>(1/2/<2F>س<EFBFBD><D8B3><EFBFBD>)<29><>
if "%ask1%"=="1" (
goto export_gp
) else (
if "%ask1%"=="2" (
goto import_gp
) else (
exit
)
)
::<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
:export_gp
if exist %gp_folder% (
rd /s /Q %gp_folder%
)
mkdir %gp_folder%
echo,
echo <20><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ֵİ<D6B5>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD>...
secedit /export /cfg %gp_name%
echo,
echo <20><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>а<EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...
xcopy /e /h /r /y %gp_file% %gp_export_file%\
echo,
echo <20><><EFBFBD>ڹ鵵<DAB9>ļ<EFBFBD>...
attrib -h %gp_export_file%
move %gp_export_file% %gp_folder%
echo,
echo <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѵ<EFBFBD><D1B5><EFBFBD><EFBFBD><EFBFBD>%gp_folder%<EFBFBD>ļ<EFBFBD><EFBFBD>У<EFBFBD>
echo,
echo <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־...
if exist logs del %logs%
echo,
set /p ask2=<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>򿪲鿴<EFBFBD><EFBFBD>y <20>鿴/n <20>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD>
if /i "%ask2%"=="n" exit
if /i "%ask2%"=="y" explorer %gp_folder%
exit
::<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
:import_gp
echo,
if exist %gp_folder% (
if exist %gp_name% (
if exist %gp_folder%GroupPolicy (
echo <20><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ֵİ<D6B5>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD>...
secedit /configure /db %db_name%.sdb /CFG %gp_name%
echo,
echo <20><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>а<EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...
xcopy /e /h /r /y %gp_folder%GroupPolicy %gp_file%
echo,
echo ˢ<><CBA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...
gpupdate /force
echo <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѵ<EFBFBD><D1B5><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>
echo,
echo <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>־...
del %db_name%.jfm
del %db_name%.sdb
if exist logs del %logs%
echo,
echo <20><><EFBFBD>س<EFBFBD><D8B3><EFBFBD><EFBFBD>˳<EFBFBD>...
pause > nul
exit
) else (
echo <20><>GroupPolicy<63><79><EFBFBD>ļ<EFBFBD><C4BC>в<EFBFBD><D0B2><EFBFBD><EFBFBD>ڣ<EFBFBD>
pause
)
) else (
echo <20><>%db_name%.inf<6E><66><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>
pause
)
) else (
echo <20><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>Թ<EFBFBD><D4B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>в<EFBFBD><D0B2><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3>
pause
)