[windows2000] SUS Server Update Notification Script

If you are at all like me, you love the fact that Microsoft has released a
free tool for us to keep our machines up to date (SUS Server) but hate the
fact that there is no notification facility, so you have to check the SUS
Admin page for new patches to approve every day.

Also, if you are like me, you forget, even with the constant reminders in
the form of Security Bulletins and list traffic about each patch, to go and
approve updates.

That sort of minimizes the effectiveness of an on-site SUS server...

So, I wrote a script to check for changes in the SUS content folder, and
email me a notification so I don't forget.

I figured, since I spent the time to get this working, I might as well share
it...

Be careful of line wrap.  I am going to precede each line with a line
number, a hyphen, and a space.  Remove these, and save this as a .cmd file.
Then change the variables at the top to match your environment and schedule
this to run sometime after your SUS synch happens but before you get in in
the morning...

<------Start Script---------->
 1- @ECHO OFF
 2- 
 3- :Variables
 4- SETLOCAL
 5- set @WorkDir=%~dp0SUSChangesWork
 6- set @SUSFolder="C:\sus\content"
 7- set @NewUpdates=NO
 8- set @SUSurl=http://SUSServerName/SUSAdmin
 9- set @BlatLoc=c:\tools\blat\blat.exe
10- set @ForFilesLoc=c:\tools\forfiles.exe
11- set @MailTo=MyEmail
12- set @SMTPDomain=@xxxxxxxxxx
13- set @MsgSubject="SUS Changes"
14- set @MsgBody="There appear to be changes to the SUS Server list of
updates.  Please visit %@SUSurl% to approve new updates."
15- set @MailFrom=SUSChanges
16- set @MailServer=MailServer
17- 
18- IF /I NOT EXIST "%@WorkDir%" MD "%@WorkDir%"
19- 
20- FOR /F "TOKENS=*" %%D IN ('%@ForFilesLoc% -p%@SUSFolder% -d+0 -s -c"CMD
/C ECHO @FILE"') DO CALL :FoundOne "%%D"
21- IF %@NewUpdates%==YES call :Notify
22- 
23- GOTO :ExitBatch
24- 
25- :FoundOne
26- IF not %1=="cabs" SET @NewUpdates=YES
27- GOTO :EOF
28- 
29- :Notify
30- Echo Found Changes - Notify
31- echo . > "%@WorkDir%\body.txt"
32- %@BlatLoc% "%@WorkDir%\body.txt" -q -to %@MailTo%%@SMTPDomain% -subject
%@MsgSubject% -body %@MsgBody% -server %@MailServer% -f
%@MailFrom%%@SMTPDomain%
33- GOTO :EOF
34- 
35- :ExitBatch
36- del /q "%@WorkDir%\*.*"
37- rd /q "%@WorkDir%"
38- ENDLOCAL
<------End Script---------->

If anyone has any trouble unwrapping the lines, email me OFF-LIST and I will
email it to you directly.

Hope this helps someone,

Glenn Sullivan, MCSE+I  MCDBA
David Clark Company Inc.
********************************************************************
This Week's Sponsor: RTO Software - TScale
TScale increases Terminal Server capacity. Get 30-40% more users per
server to save $$$ and time. Add users now! - Not more servers.
If you?re using Citrix, you must learn about TScale!  
Free 30-day eval: http://www.rtosoft.com/Enter.asp?ID=80

==================================
To Unsubscribe, set digest or vacation
mode or view archives use the below link.

http://thethin.net/win2000list.cfm

Other related posts: