Useful Scripts
These are some simple scripts that I have written to automate one process or another at some time. They are posted here in the hope that they may be useful to someone else. (And lets be honest, so that I can come back to use them as well!)
Collecting Print Job Information from Windows Event Logs
This Windows batch script employees the dumpel.exe program to pull print job information from Windows events logs. Running it on a daily basis using the task scheduler provides me with detailed printer usage.
REM Where to save the log file
Set LogDir=c:\Audit\Logs
REM format the date for use in my file name
for /f "tokens=1,2,3 delims=/" %%i in ('echo %date%') do Set DateFlat=%%k%%j%%i
REM Collect the event logs
for %%s in (printserver1 printserver2 printserver3) ^
do "C:\Program Files\Resource Kit\dumpel" -s \\%%s -format dtucs -t -l System -e 10 -m Print -d 1 >> %logDir%\%%s_jobs_%DateFlat%.csv
Concatenate Mcafee Logs
This bash script is used to collect the On-Demand scan logs from my servers and then concatenate them into one file for a quick check.
#!/bin/bash
#Concatenating Mcafee logs on my servers for easy viewing
output=mcafee-logs.txt
for server in servername1 servername2 servername3 servername4
do
echo 'Adding the log from' $server
cat //$server/c\$/Documents\ and\ Settings/All\ Users/Application\ Data/McAfee/DesktopProtection/OnDemandScanLog.txt >> $output
done