Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @ECHO OFF
- :: poorman Local Security Policy (Audit Policy) batch script v1.3
- :: will enable success/failure for all audits except DS access
- :: require auditpol.exe if not exist
- :: win ver part shamelessly from Denis St-Pierre
- :: tdr.local[at]gmail.com
- VER | FINDSTR /L "5.0." > NUL:
- IF %ErrorLevel% EQU 0 (
- ECHO System is running Win 2000
- C:\Windows\System32\auditpol.exe /enable /system:all /logon:all /object:all /privilege:all /process:all /policy:all /sam:all
- )
- VER | FINDSTR /L "5.1." > NUL:
- IF %ErrorLevel% EQU 0 (
- ECHO System is running Win XP
- GOTO Win_XP_2003
- )
- VER | FINDSTR /L "5.2." > NUL:
- IF %ErrorLevel% EQU 0 (
- ECHO System is running Win 2003
- GOTO Win_XP_2003
- )
- VER | FINDSTR /L "6.0." > NUL:
- IF %ErrorLevel% EQU 0 (
- If EXIST %SystemRoot%\System32\ServerManagerLauncher.exe (
- ECHO Running Windows 2008R1
- GOTO Win_Vista_7_2008
- ) ELSE (
- ECHO System is running Win Vista
- GOTO Win_Vista_7_2008
- )
- )
- VER | FINDSTR /L "6.1." > NUL:
- IF %ErrorLevel% EQU 0 (
- If EXIST %SystemRoot%\System32\ServerManagerLauncher.exe (
- ECHO Running Windows 2008R2
- GOTO Win_Vista_7_2008
- ) ELSE (
- ECHO System is running Windows 7
- GOTO Win_Vista_7_2008
- )
- )
- :Win_XP_2003
- Echo copying Auditpol.exe to system32...
- REM change the IP address to share server's IP
- xcopy "\\192.168.44.1\auditpol\Auditpol.exe" C:\Windows\system32
- Echo Enabling Auditing...
- C:\Windows\system32\Auditpol.exe /enable /system:all /logon:all /object:all /privilege:all /process:all /policy:all /sam:all
- GOTO EXEC_CMD
- :Win_Vista_7_2008
- C:\Windows\System32\auditpol.exe /set /category:"Account Logon" /success:enable /failure:enable
- C:\Windows\System32\auditpol.exe /set /category:"Object Access" /success:enable /failure:enable
- C:\Windows\System32\auditpol.exe /set /category:"Account Management" /success:enable /failure:enable
- C:\Windows\System32\auditpol.exe /set /category:"Detailed Tracking" /success:enable /failure:enable
- C:\Windows\System32\auditpol.exe /set /category:"DS Access" /success:disable /failure:disable
- C:\Windows\System32\auditpol.exe /set /category:"Logon/Logoff" /success:enable /failure:enable
- C:\Windows\System32\auditpol.exe /set /category:"Policy Change" /success:enable /failure:enable
- C:\Windows\System32\auditpol.exe /set /category:"Privilege Use" /success:enable /failure:enable
- C:\Windows\System32\auditpol.exe /set /category:"System" /success:enable /failure:enable
- GOTO EXEC_CMD
- :EXEC_CMD
- ECHO Continue with Audit Policy..
- PAUSE
- START c:\windows\system32\secpol.msc
Add Comment
Please, Sign In to add comment