Solved

WSUS Server 3 Automate Server Cleanup / DB

Posted on 2009-05-05
10
1,063 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to run the DNS query from the server? 5 87
clearing an obsolete 2003 server from our domain 8 79
Big Problem with Redirected Folder 8 66
Drive mapping problem 7 44
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…
A quick step-by-step overview of installing and configuring Carbonite Server Backup.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

749 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