0
我試圖尋找使用下面的批處理文件鍵值註冊表,但也有不一致之處與ERRORLEVEL返回:批處理文件搜索註冊表
@Echo off
setlocal
set PATHFIX=%CD%
set LOGFILE=%SYSTEMDRIVE%\windows\IA\%COMPUTERNAME%-ISPA_Windows_7_STIG_V1R9_27_Jul_2012-%DATE%.txt
echo Log file name will be %LOGFILE%
echo Security Template logfile for %COMPUTERNAME% > %LOGFILE%
echo -- >> %LOGFILE%
for /f "delims=*" %%i in ('time /t') do set TIME=%%i
echo Date run: %DATE% >> %LOGFILE%
echo Time run: %TIME% >> %LOGFILE%
echo -- >> %LOGFILE%
echo Windows_7_STIG_V1R9 27 Jul 2012 >> %LOGFILE%
echo =============================================================================================== >> %LOGFILE%
FOR /F "tokens=1,2,3,4,5,6,7,8,9 delims= " %%F IN (WINDOWS_7_V1R9.txt) DO (
reg query "%%F" /v "%%H" /t "%%I" | Find "%%J"
IF not ERRORLEVEL 1 (
echo %%G Compliant
echo %%G %%K Compliant %%M>> %LOGFILE%
echo -- >> %LOGFILE%
) ELSE (
echo %%G Non-Compliant
echo %%G %%K Non-Compliant %%F\%%H %%I %%J >> %LOGFILE%
echo -- >> %LOGFILE%
)
)
echo -- >> %LOGFILE%
:PATCHES_COMPLETE
for /f "delims=*" %%i in ('time /t') do set TIME=%%i
echo -- >> %LOGFILE%
echo ISPA-STIG for %COMPUTERNAME% completed at: %TIME% >> %LOGFILE%
pause
exit
的文本文件設置如下:
HKLM \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies \ System V-1075 ShutdownWithoutLogon REG_DWORD 0x1 ECSC-1 SV-25111r1_rule顯示關機按鈕
任何援助將不勝感激。