Solved

WSUS Server 3 Automate Server Cleanup / DB

Posted on 2009-05-05
10
1,072 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
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

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Auto Login Script 3 84
Big Problem with Redirected Folder 8 78
Time server on domain 3 64
Active Directory Powershell Script 9 44
I guess it is not common knowledge to most Wintel engineers/administrators: If you have an SNMP-based monitoring system in your environment (and it's common to have SNMP or Syslog) it's reasonably easy to enable monitoring of the Windows Event logs,…
Learn about cloud computing and its benefits for small business owners.
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

752 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