Solved

WSUS Server 3 Automate Server Cleanup / DB

Posted on 2009-05-05
10
1,055 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

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.   …
Many of us need to configure DHCP server(s) in their environment. We can do that simply via DHCP console on server or using MMC snap-in on each computer with Administrative Tools installed in a network. But what if we have to configure many DHCP ser…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.

777 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