|
|
How do I reclaim disk space on a WSUS 2 server? I have a lot of declined patches that could be cleaned up.
|
|
"Erik Mattsson" <erikm[ at ]bredband.net> wrote in message news:OkiW40uSJHA.1164[ at ]TK2MSFTNGP03.phx.gbl...
[Quoted Text] > How do I reclaim disk space on a WSUS 2 server? I have a lot of declined > patches that could be cleaned up.
Well, the *best* solution is to upgrade to WSUS 3.0 SP1 and run the Server Cleanup Wizard.
However, lacking that option, you'll want to use the WSUSServerDebugTool with the /purgeunneededfiles option.
The WSUSServerDebugTool can be obtained from http://download.microsoft.com/download/7/7/4/7745a34e-f563-443b-b4f8-3a289e995255/WSUS%20Server%20Debug%20Tool.EXE
-- Lawrence Garvin, M.S., MCITP(x2), MCTS(x5), MCP(x7), MCBMSP Principal/CTO, Onsite Technology Solutions, Houston, Texas Microsoft MVP - Software Distribution (2005-2009)
MS WSUS Website: http://www.microsoft.com/wsus My Websites: http://www.onsitechsolutions.com; http://wsusinfo.onsitechsolutions.com My MVP Profile: http://mvp.support.microsoft.com/profile/Lawrence.Garvin
|
|
I run this batch file once a month =======WSUSCleanUp.cmd========= Rem Batch file written by From: "Michael D. Ober" Rem and published to WSUS newsgroup Jan 2006 Rem Modified to set the LogDir withing the script - Dave Mills Rem Modified to use the date format for UK settings - Dave Mills
setlocal pushd "c:\program files\update services\tools"
Rem Set a Logfile folder Set LogDir=C:\LogDir
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%%b%%a set logfile=%LogDir%\WSUSCleanUp md "%logfile%" set logfile="%LogDir%\WSUSCleanUp\%USERNAME% on %COMPUTERNAME% - %date%.log"
dir D:|Find "Dir(s)">space.txt 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%
echo.>> %logfile% echo Space before cleanup>> %logfile% type space.txt>> %logfile% echo.>> %logfile% echo Space after cleanup>> %logfile% echo.>> %logfile% dir D:|Find "Dir(s)">> %logfile% echo.>> %logfile%
Rem email the report to Administrator Rem to Send a files content the file must by in the current folder. Copy log file to a temp. Del sendmail.tmp copy %logfile% sendmail.tmp cscript \\gimli\util\CDO_sendmail.vbs /TO smtp[ at ]address /FROM "Gimli" /SUBJECT "WSUS Cleanup report" /MESSAGE sendmail.tmp /SERVER Faramir Del sendmail.tmp
popd endlocal
========CDO_Sendmail.cmd========= '* Copyright (C) 2004 Andrew Loree '* Parts Copyright (c) 2007 DJMills '* $Id: sendmail.vbs,v 1.5 2004/09/27 13:55:14 andy Exp $ '**************************************************************************** '* sendmail.vbs - Sends an email using the specified command line args '**************************************************************************** '* This program is free software; you can redistribute it and/or '* modify it under the terms of the GNU General Public License '* as published by the Free Software Foundation; either version 2 '* of the License, or (at your option) any later version. '* '* This program is distributed in the hope that it will be useful, '* but WITHOUT ANY WARRANTY; without even the implied warranty of '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the '* GNU General Public License for more details. '* '* You should have received a copy of the GNU General Public License '* along with this program; if not, write to the Free Software '* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. '**************************************************************************** '* Version History: '* 1.0 - Initial Release '* 2.0 - Modified by D J Mills ' Changed Usage output to a single message. (for wscript) ' Added Message can be either text or a filename. If it is a filename ' the file contents becomes the message. '**************************************************************************** Option Explicit
Dim sTo, sFrom, sSubject, sMessage, sSMTPServer, nSMTPPort, bVerbose
Dim sOutput
SetDefaults()
If (ParseCommandLine()) Then If (bVerbose) Then sOutput = "To: " & sTo sOutput = sOutput & VbCrLf & "From: " & sFrom sOutput = sOutput & VbCrLf & "Subject: " & sSubject sOutput = sOutput & VbCrLf & "Message: " & sMessage sOutput = sOutput & VbCrLf & "Server: " & sSMTPServer sOutput = sOutput & VbCrLf & "Port: " & nSMTPPort WScript.Echo(sOutput) End If Call SendEmail(sFrom,sTo,sSubject,sMessage,sSMTPServer,nSMTPPort) Else ' Failed to parse command line options or asked for help ShowUsage() End If
' ShowUsage - Shows command line usage Function ShowUsage() sOutput = "CDO_sendmail.vbs - Sends emails using cdo" sOutput = sOutput & VbCrLf & "Usage: sendmail.vbs /TO recipients [/FROM address] [/SUBJECT subject]" sOutput = sOutput & VbCrLf & " [/MESSAGE message] [/SERVER server] [/PORT port]" sOutput = sOutput & VbCrLf & " [/VERBOSE]" sOutput = sOutput & VbCrLf sOutput = sOutput & VbCrLf & "recipients: Required, comma seperated list of recipients." sOutput = sOutput & VbCrLf & " Use quotes if the list might contain spaces" sOutput = sOutput & VbCrLf & "address: Sender from address. If not specified, current user" sOutput = sOutput & VbCrLf & " and machine name will be used" sOutput = sOutput & VbCrLf & "subject: Subject line, use quotes if it includes spaces" sOutput = sOutput & VbCrLf & "message: Message body, If it is a filename the file contents" sOutput = sOutput & VbCrLf & " become the body text." sOutput = sOutput & VbCrLf & "server: SMTP server. Default is localhost" sOutput = sOutput & VbCrLf & "port: SMTP Port. Default is 25" sOutput = sOutput & VbCrLf & "/verbose Writes message parameters to standard out before sending" WScript.Echo(sOutput) End Function
' SetDefaults - Sets initial values Function SetDefaults() Dim WshNetwork
sFrom = "" sSMTPServer = "localhost" ' Default nSMTPPort = 25 sSubject = "[No Subject]" sMessage = "" bVerbose = False Set WshNetwork = CreateObject("WScript.Network") If (Len(sFrom) = 0) Then sFrom = WshNetwork.UserName & "[ at ]" & WshNetwork.ComputerName End If Set WshNetwork = Nothing End Function
' ParseCommandLine - Parses command line options into global vars Function ParseCommandLine() Dim objArgs, i, sNextArg
Set objArgs = WScript.Arguments For i = 0 To objArgs.Count - 1 If (i < objArgs.Count - 1) Then sNextArg = objArgs(i+1) Else sNextArg = "" End If Select Case (UCase(objArgs(i))) Case "/TO": sTo = sNextArg i = i + 1 Case "/FROM": sFrom = sNextArg i = i + 1 Case "/SUBJECT": sSubject = sNextArg i = i + 1 Case "/MESSAGE": sMessage = sNextArg i = i + 1 Case "/SERVER": sSMTPServer = sNextArg i = i + 1 Case "/PORT": nSMTPPort = sNextArg i = i + 1 Case "/VERBOSE": bVerbose = True Case "/HELP": ParseCommandLine = False Exit Function Case "/H": ParseCommandLine = False Exit Function End Select Next
' Check for valid arguments If (Len(sTo) > 0) Then ParseCommandLine = True Else ParseCommandLine = False End If
End Function
' SendEmail - Sends an email using cdo to the specified Function SendEmail(sFrom, sTo, sSubject, sMessage, sSMTPServer, nSMTPPort) Dim oMsg, oConf, oFields, WshNetwork, objFSO, fsoStream Const cdoSendUsingPort = 2 Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing" Const cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver" Const cdoSMTPServerPort = "http://schemas.microsoft.com/cdo/configuration/smtpserverport" Const ForReading = 1
If (Len(sTo) > 0) Then Set oMsg = CreateObject("CDO.Message") Set oConf = CreateObject("CDO.Configuration") Set WshNetwork = CreateObject("WScript.Network") Set oFields = oConf.Fields
' Set SMTP server configuration oFields.Item(cdoSendUsingMethod) = cdoSendUsingPort oFields.Item(cdoSMTPServer) = sSMTPServer oFields.Item(cdoSMTPServerPort) = nSMTPPort oFields.Update
'Get the message body. Test sMessage and if it is a file then read the contentt Set objFSO = CreateObject("Scripting.FileSystemObject") If (objFSO.FileExists(sMessage)) Then Set fsoStream = objFSO.OpenTextFile(sMessage, ForReading) sMessage = fsoStream.ReadAll fsoStream.Close Set fsoStream = Nothing End If Set objFSO = Nothing
'// Set the message properties. oMsg.Configuration = oConf oMsg.To = sTo oMsg.From = sFrom oMsg.Subject = sSubject oMsg.Organization = "Sent from " & WshNetwork.ComputerName & " by " & WshNetwork.UserName oMsg.TextBody = sMessage
oMsg.Send
Set WshNetwork = Nothing Set oMsg = Nothing Set oConf = Nothing End If
End Function
On Fri, 21 Nov 2008 00:02:22 -0600, "Lawrence Garvin \(MVP\)" <lawrence[ at ]news.postalias> wrote:
[Quoted Text] >"Erik Mattsson" <erikm[ at ]bredband.net> wrote in message >news:OkiW40uSJHA.1164[ at ]TK2MSFTNGP03.phx.gbl... >> How do I reclaim disk space on a WSUS 2 server? I have a lot of declined >> patches that could be cleaned up. > >Well, the *best* solution is to upgrade to WSUS 3.0 SP1 and run the Server >Cleanup Wizard. > >However, lacking that option, you'll want to use the WSUSServerDebugTool >with the /purgeunneededfiles option. > >The WSUSServerDebugTool can be obtained from > http://download.microsoft.com/download/7/7/4/7745a34e-f563-443b-b4f8-3a289e995255/WSUS%20Server%20Debug%20Tool.EXE -- Dave Mills There are 10 types of people, those that understand binary and those that don't.
|
|
|
|
On Sat, 22 Nov 2008 12:11:56 -0600, "Lawrence Garvin \(MVP\)" <lawrence[ at ]news.postalias> wrote:
[Quoted Text] >"DaveMills" <DaveMills[ at ]newsgroup.nospam> wrote in message >news:ed4gi4d1l1inntk6tac3kkouscst3iharg[ at ]4ax.com... >>I run this batch file once a month > >On WSUS v3 servers??? > >Or do you still have WSUS v2 servers online?
Still W2k at home unfortunately Also see the subject of this post.
-- Dave Mills There are 10 types of people, those that understand binary and those that don't.
|
|
"DaveMills" <DaveMills[ at ]newsgroup.nospam> wrote in message news:g99ii41fjqag4hmfe89q736l0oba89e3fg[ at ]4ax.com...
[Quoted Text] >>"DaveMills" <DaveMills[ at ]newsgroup.nospam> wrote in message >>news:ed4gi4d1l1inntk6tac3kkouscst3iharg[ at ]4ax.com... >>>I run this batch file once a month >> >>On WSUS v3 servers??? >> >>Or do you still have WSUS v2 servers online? > > Still W2k at home unfortunately
Ahhh....
> Also see the subject of this post.
Yes.. I did... thus the double take on your comment, as I expected you would have been one of the first to have upgraded to WSUS 3 waybackwhen.
But I do understand the Windows 2000 limitations in the [ at ]Home network. :-)
-- Lawrence Garvin, M.S., MCITP(x2), MCTS(x5), MCP(x7), MCBMSP Principal/CTO, Onsite Technology Solutions, Houston, Texas Microsoft MVP - Software Distribution (2005-2009)
MS WSUS Website: http://www.microsoft.com/wsus My Websites: http://www.onsitechsolutions.com; http://wsusinfo.onsitechsolutions.com My MVP Profile: http://mvp.support.microsoft.com/profile/Lawrence.Garvin
|
|
|