Solved

WSUS Server 3 Automate Server Cleanup / DB

Posted on 2009-05-05
10
1,046 Views
Last Modified: 2012-06-27
I am looking for a way to automate the server cleanup tasks in WSUS.   Through the use of a batch file or script preferably.
0
Comment
Question by:klyptix
10 Comments
 
LVL 21

Expert Comment

by:JBlond
ID: 24309337
http://forums.techarena.in/server-update-service/434984.htm

Put this script in the tools-folder of WSUS and run it using 'Scheduled tasks' as often as you want (weekly/monthly/...)

Hope this helps
0
 

Author Comment

by:klyptix
ID: 24309451

Excellent File.  

You have to download the debug tools.
Also, when copying the script make sure to fix the line breaks.

I ran it, will run it again soon to test and see if everything works correctly.

Script with line breaks is below.
Rem Batch file written by From: "Michael D. Ober"

Rem and published to WSUS newsgroup Jan 2006
 

setlocal

pushd "C:\Program Files\Update Services\Tools"
 

Rem Set a Logfile folder

Set LogDir=C:\Program Files\Update Services\Tools\Logs
 

for /F "tokens=1" %%a in ('date /t') do set day=%%a

for /F "tokens=2" %%a in ('date /t') do set date=%%a

for /F "tokens=1, 2, 3 delims=/" %%a in ("%date%") do set date=%%c%%a%%b

set logfile=%LogDir%\WSUSCleanUp

md "%logfile%"

set logfile="%LogDir%\WSUSCleanUp\%USERNAME% on %COMPUTERNAME% - %date%.log"
 

echo Stopping WSUS %date%:%time%>> %logfile%

net stop "Update Services" >> %logfile%
 

echo Deleting Unneeded Revisions %date%:%time%>> %logfile%

wsusutil.exe deleteunneededrevisions >> %logfile%
 

echo Starting WSUS %date%:%time%>> %logfile%

net start "Update Services" >> %logfile%

WsusDebugTool.exe /Tool:PurgeUnneededFiles >> %logfile%
 

echo Finished %date%:%time%>> %logfile%

popd

endlocal

Open in new window

0
 

Author Comment

by:klyptix
ID: 24309471
Found a problem

Line 21: wsusutil.exe deleteunneededrevisions >> %logfile%

Generates this in the log file:
Unknown command. The following commands are known:
      help
      checkhealth
      configuressl
      configuresslproxy
      deletefrontendserver
      listinactiveapprovals
      removeinactiveapprovals
      export
      healthmonitoring
      import
      listfrontendservers
      movecontent
      reset
      usecustomwebsite
      listunreferencedpackagefolders
0
 
LVL 21

Expert Comment

by:JBlond
ID: 24311701
Just noticed that MS has removed that option from WSUS 3.x

What I've found:
http://www.pulsarit.net/cs/blogs/claudiog/archive/2007/05/16/eseguire-wsus-3-0-cleanup-manager-via-powershell.aspx

It's an italian blog but you basically need only the powershell script at the end.  Powershell has to be installed on the WSUS server of course.

Another comment from a MS employee saying that the only left option is to use the WsusDebugTool with the option /Tool:PurgeUnneededFiles

http://www.tech-archive.net/Archive/Windows/microsoft.public.windows.server.sbs/2007-09/msg00898.html
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 47

Expert Comment

by:dstewartjr
ID: 24317181
You can also use these other command line options
 
http://msmvps.com/blogs/athif/archive/2005/10/27/Purge-Delete-the-downloaded-patches-on-WSUS-Server.aspx
 
WSUSUTIL.exe Deleteunneededrevisions
WSUSUTIL.exe Removeinactiveapprovals

0
 

Author Comment

by:klyptix
ID: 24336596

dstewartjr: Unfortunately  those commands were removed for wsus 3.0
0
 

Author Comment

by:klyptix
ID: 24336603

Correction:  WSUSUTIL.exe Deleteunneededrevisions  was removed
0
 

Accepted Solution

by:
ee_auto earned 0 total points
ID: 24994536
Question PAQ'd, 500 points refunded, and stored in the solution database.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Scenerio: You have a server running Server 2003 and have applied a retail pack of Terminal Server Licenses.  You want to change servers or your server has crashed and you need to reapply the Terminal Server Licenses. When you enter the 16-digit lic…
On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now