Powershell & WSUS Updates

Posted on 2014-08-11
Last Modified: 2016-02-20
can someone help me out here? I'm trying to get WSUS updates via powershell with the command:
$WsusServerAdminProxy.GetUpdates() | ?{-not $_.IsDeclined -and $_.ProductTitles -match "Windows XP” }

That's listing all Updates for Windows XP correctly.. but it lists also the Updates which are for "Windows XP, Windows 2003". But I'd would only decline the updates which are for XP only.

I tried to reach that so: Change -match "Windows XP"  to -eq "Windows XP”, or -like "Windows XP” , but nothing worked.

[reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") | out-null
$WsusServerAdminProxy = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer($WsusServer,$UseSSL,$PortNumber);
$updates = $WsusServerAdminProxy.GetUpdates() | ?{-not $_.IsDeclined -and $_.ProductTitles -like "Windows XP” }
Question by:Lionstone

    Accepted Solution

    I found it out myself hand with the help in the #Powershell Chat.

    ?{-not $_.IsDeclined -and $_.ProductTitles -match "Windows XP" -and $_.ProductTitles.Count -lt "2" }

    Author Closing Comment

    luckily the ProductTitles don't count two for XP 32bi and XP 64bit, because this are separate updates. Otherwise it wouldn't work.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    This article covers how to install the Microsoft Windows Operating System (OS). What is covered in this article:  > Different Versions and Editions of the Windows OS  > Upgrading versus Fresh Installation of the OS           - Steps to take pr…
    INTRODUCTION The purpose of this document is to demonstrate the Installation and configuration of the Data Protection Manager product. Note that this demonstration was prepared on the basis of Windows OS is 2008 R2 and DPM 2010. DATA PROTECTI…
    In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

    758 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

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now