Bart's Weblog

Just a blog…

Archive for the ‘WSUS’ Category

WSUS: Automatically Declining Itanium Updates

Posted by bartvdw on 0606/0505/2013

This is quiet useful, and easier then using the GUI to filter them out…

Automatically Declining Itanium Updates in WSUS
http://gallery.technet.microsoft.com/scriptcenter/Automatically-Declining-a4fec7be

Adapt the code if you don’t want to have an email sent (ex. output to screen or dump in a text file).

Posted in PowerShell, WSUS | 5 Comments »

WSUS: PoshPAIG (PowerShell Patch Audit/Installation GUI)

Posted by bartvdw on 0606/0505/2013

PoshPAIG (PowerShell Patch Audit/Installation GUI)
http://poshpaig.codeplex.com

Posted in Microsoft, PowerShell, WSUS | Leave a Comment »

WSUS: Approve all needed updates for a computer group using a member as reference

Posted by bartvdw on 0606/0505/2013

Approve updates for a computer group using a member as reference (computer using as reference must be member of that group); adapt variables in the beginning of the script to suit your needs (this is not for WSUS on Windows Server 2012!!):

[reflection.assembly]::LoadWithPartialName(“Microsoft.UpdateServices.Administration”) | out-null
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer(‘wsus.domain.local’,$false,80);
$groupName = “Servers”
$computerName = “reference.domain.local”
$approveUpdates = $false

$group = $null
$computer = $wsus.GetComputerTargetByName($computerName)
$groups = $computer.GetComputerTargetGroups() | foreach-object {
If ($_.Name -eq $groupName) {
$group = $_;
}
}
Function GetComputerGroupByName ($group) {
$wsus.GetComputerTargetGroups() | foreach-object {
if ($_.Name -eq $group) {$_;}
}
}
if ($group -eq $null) {throw new-object System.Exception($computerName + ” doesn’t below to group ” + $groupName)}

$updateScope = new-object Microsoft.UpdateServices.Administration.UpdateScope;
$updateScope.IncludedInstallationStates = “NotInstalled”
#$updateScope.ApprovedStates = “NotApproved”

$action = [Microsoft.UpdateServices.Administration.UpdateApprovalAction]::Install;
$updates = $computer.GetUpdateInstallationInfoPerUpdate($updateScope);
$updates | foreach-object {
$u = $wsus.GetUpdate($_.UpdateId);
If ($approveUpdates) {
$u.Approve($action,$group);
} else {“Need to approve ” + $u.Title}
};

Approve Needed Updates
http://gallery.technet.microsoft.com/e3b33372-1e7f-41ea-ad83-ecc10ba5f0f6

Posted in Microsoft, WSUS | 2 Comments »

WSUS: Backup/restore configuration

Posted by bartvdw on 3030/0707/2012

Recently I found great information about backing up your WSUS configuration, meaning the approvals and computer groups, not the content. Below the information including the source I found explaining the backup/restore method. The article referenced also explains some common issues regarding KB 2720211 for WSUS.

Download the API samples & tools, extract the WSUSmigrationexport.exe tool and copy it to C:\Program Files\Update Services\tools

If issues, download the recompiled version from CodePlex which includes a fix for a bug described in KB 945348.

Then create 2 batch files, first one backup.bat, second one restore.bat (change directory for backup location as required/desired):

mkdir c:\wsusbackup
wsusutil.exe export c:\wsusbackup\metadata.cab c:\wsusbackup\metadata.log
wsusmigrationexport3.exe c:\wsusbackup\configuration.xml

wsusutil.exe import c:\wsusbackup\metadata.cab c:\wsusbackup\metadata.log
wsusmigrationimport3.exe c:\wsusbackup\configuration.xml all none
wsusutil.exe reset

Update Services 3.0 API Samples and Tools (Microsoft)
http://download.microsoft.com/download/5/d/c/5dc98401-bb01-44e7-8533-3e79ae0e0f97/Update%20Services%203.0%20API%20Samples%20and%20Tools.EXE

Error message when you try to use the WsusMigrationImport tool to import data into a WSUS 3.0 server: "WsusMigration failed with the below exception"
http://support.microsoft.com/kb/945348

WSUSMigrationImport (CodePlex)
http://wsus.codeplex.com/releases/view/18460

WSUS KB2720211 : Common issues encountered and how to fix them
http://blogs.technet.com/b/sus/archive/2012/06/20/wsus-kb272011-common-issues-encountered-and-how-to-fix-them.aspx

Posted in WSUS | Leave a Comment »

PowerShell: WSUS cleanup script

Posted by bartvdw on 0808/0606/2012

This script allows you to schedule WSUS cleanup on a regular basis.

[reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") | out-null
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer();
$cleanupScope = new-object Microsoft.UpdateServices.Administration.CleanupScope;
$cleanupScope.DeclineSupersededUpdates = $true       
$cleanupScope.DeclineExpiredUpdates         = $true
$cleanupScope.CleanupObsoleteUpdates     = $true
$cleanupScope.CompressUpdates                  = $true
#$cleanupScope.CleanupObsoleteComputers = $true
$cleanupScope.CleanupUnneededContentFiles = $true
$cleanupManager = $wsus.GetCleanupManager();
$cleanupManager.PerformCleanup($cleanupScope);

WSUS Cleanup
http://gallery.technet.microsoft.com/ScriptCenter/fd39c7d4-05bb-4c2d-8a99-f92ca8d08218/

Posted in PowerShell, WSUS | Leave a Comment »

WSUS 3.0 database maintenance (re-index)

Posted by bartvdw on 0808/0606/2012

It’s advised to perform maintenance on the WSUS 3.0 database from time to time, if not the performance can degrade over time. The script is published on the TechNet Script Center website.

Re-index the WSUS 3.0 Database
http://gallery.technet.microsoft.com/scriptcenter/6f8cde49-5c52-4abd-9820-f1d270ddea61#content

Posted in WSUS | Leave a Comment »

Decline superseded updates in WSUS

Posted by bartvdw on 0707/0303/2010

Although you can use the server cleanup wizard, you may want from time to time to clean manually all superseded updates to clean your WSUS infrastructure.

The trick here is to have the column ‘Supersedence’ is visible. Open WSUS console and go to ‘All Updates’. Enable the ‘Supersedence’ column.

image8

Now there are 4 options:

  • No icon: update doesn’t supersede another one nor is it superseded by an update
  •  image11 Blue square on top: this update supersedes another update, these updates you do not want to clean…!!
  •  image14 Blue square in the middle: this update has been superseded by another update, and superseded another update as well, this is an example of an update you may want to clean (decline)
  •  image17 Blue square in the right below corner: this update has been superseded by another update, this is an example of an update you may want to clean (decline)

Note: Always verify that all superseding updates are approved before doing this operation!

Posted in WSUS | 1 Comment »

Move WSUS content to another drive/partition

Posted by bartvdw on 0707/0303/2010

This is, for WSUS 3.0, a very easy job to do! Actually they have a built-in tool. So if you have installed WSUS and discover your partition is filling up, you can easily move the content to another partition using the ‘wsusutil.exe’ utility. You can find this utility typically in ‘C:\Program Files\Update Services\Tools\’.

Command: wsusutil.exe movecontent %content path% %logfile% –skipcopy

%content path% : The new root for content files. The path must exist.
%logfile% : Path and filename of the log file to create.
-skipcopy : Indicates that only the server configuration should be changed and that the content files should not be copied.

Posted in WSUS | 4 Comments »

Limit SQL Server maximum memory allocation for WSUS instance

Posted by bartvdw on 0707/0303/2010

One thing you can discover after installing WSUS with a SQL instance (Express) is that the memory allocated by the SQL instance grows quiete big. To prevent this, adjust after installation the maximum memory allocation for the SQL instance.

There are 2 options to do this:

  • command-line (osql)
  • SQL Management Studio

Command-lin (osql) method:

  • Open cmd
  • osql -E -S YOURSERVERNAME\sbsmonitoring [hit enter]
  • sp_configure ‘show advanced options’,1 [hit enter]
  • reconfigure with override [hit enter]
  • go [hit enter]
  • sp_configure ‘max server memory’, 256 [hit enter] (based on the information I found, this is OK)
  • reconfigure with override [hit enter]
  • go [hit enter]

SQL Management Studio method:

  • If you haven’t installed it yet, download the SQL Server Management Studio Express from the Microsoft website
  • Open SQL Server Management Studio Express
  • Connect to \\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query
  • Right-click on the database and select ‘Properties’
  • Select page ‘Memory’ and change ‘Maximum server memory (in MB)’ to value 256
    image 
  • Click ‘OK’

Restarting the SQL instance afterwards is recommended.

Posted in WSUS | 2 Comments »