WSUS

WSUS Snippets

For diagnosing slow downloads from MS, set download to foreground

$conf=(get-wsusserver).GetConfiguration()
$conf.BitsDownloadPriorityForeground=$true
$conf.save()

Restart BITS to take effect (WSUS has a dependency, so will also restart). Set back to false after testing, obviously, else you may overload your connection.

AdamJ clean-up script – http://www.adamj.org/clean-wsus.html – sadly now commercial :(, yet another example of someone who has been given all the info by everyone else, created a simple, but useful script that so many have become reliant on, and then personal greed has set in.

Limit WID database memory use – http://www.stugr.com/2013/01/24/wsus-limit-sql-windows-internal-database-memory/ – essentially these commands from a cmd prompt:

osql -E -S \\.\pipe\Microsoft##WID\tsql\query

exec sp_configure 'show advanced option', '1';
reconfigure;
exec sp_configure;
go

Check for max server memory in output, likely to be massive such as 2Tb (output is in MB)


exec sp_configure 'max server memory', 2048;
reconfigure with override;
go
quit

This sets to 2GB (max server memory = 2048MB)

Clean up disk

Occasionally its necessary to delete all the downloaded content and redownload, in order to reclaim disk space that the WSUS Clean Up tasks fail to do.

Stop WSUS

Stop BITS

Empty the BITS queue via Powershell (this rarely works):

import-module bitstransfer
get-bitstransfer –allusers | remove-bitstransfer

Empty the BITS queue (Last resort): (need to stop BITS again if you tried powershell method above)

del "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\*.*"

Delete the contents of the WSUScontent folder (but not the folder itself

Tell WSUS to check all downloaded files are present, and download any missing ones (which will be all of them)

"%systemdrive%\Program Files\Update Services\Tools\wsusutil.exe" RESET

Above command will restart BITS and WSUS, else start them manually

A reboot may be needed if you used the del command to delete BITS queue

Other useful commands:

"%systemdrive%\Program Files\Update Services\Tools\wsusutil.exe" checkhealth
bitsadmin /list /allusers

Posted by admin in WSUS