Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

WSUS Server 3 Automate Server Cleanup / DB

Posted on 2009-05-05
10
Medium Priority
?
1,126 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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
 
LVL 47

Expert Comment

by:Donald Stewart
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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The HP utility "HP Lights-Out Online Configuration Utility for Windows Server 2003/2008" could be of great use when it comes to remotely configure a HP servers ILO WITHOUT rebooting the server. We would only need to create and run scripts using thi…
Organizations create, modify, and maintain huge amounts of data to help their businesses earn money and generally function.  Typically every network user within an organization has a bit of disk space to store in process items and personal files.   …
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…

886 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