Filter Property Value

Welcome Forums General PowerShell Q&A Filter Property Value

This topic contains 3 replies, has 3 voices, and was last updated by

2 years, 2 months ago.

  • Author
  • #60187

    Points: 1
    Rank: Member

    Hi Everyone,

    I am trying to get the list of windows updates from the WSUS server using the following PowerShell command. I get the result and I can see the first column as "Title".

    Get-WsusUpdate -Approval Unapproved | Select-Object -First 10

    But, when I try to filter the output by adding "-Property Title, Classification" to the above line, it will not give me the Title.

    Get-WsusUpdate -Approval Unapproved | Select-Object -First 10 -Property Title, Classification

    Is it because the string is too long? Can you please help me?


  • #60190

    Points: 2
    Rank: Member

    Did a quick search and found this.

    It appears the title is part of the update object, so you need to reference it like this:

    select @{Name="Title";Expression={$_.update.title}}

  • #60193

    Points: 24
    Team Member
    Rank: Member


    The Title property column is not a member of the base object but a child object.

       TypeName: Microsoft.UpdateServices.Commands.WsusUpdate
    Name                               MemberType
    ----                               ----------
    Approved                             Property
    Classification                       Property
    ComputersInstalledOrNotApplicable    Property
    ComputersNeedingThisUpdate           Property
    ComputersWithErrors                  Property
    ComputersWithNoStatus                Property
    InstalledOrNotApplicablePercentage   Property
    LanguagesSupported                   Property
    LicenseAgreement                     Property
    MayRequestUserInput                  Property
    MsrcNumbers                          Property
    MustBeInstalledExclusively           Property
    Products                             Property
    Removable                            Property
    RestartBehavior                      Property
    Update                               Property
    UpdateId                             Property
    UpdatesSupersededByThisUpdate        Property
    UpdatesSupersedingThisUpdate         Property

    You can verify that yourself with below:

    $list = Get-WsusUpdate -Approval Unapproved
    $list[0] | Get-Member -MemberType Property

    The Title property is actually hidden inside the object property "Update".

    $list = Get-WsusUpdate -Approval Unapproved
    $list[0].Update | Get-Member -MemberType Property
       TypeName: Microsoft.UpdateServices.Internal.BaseApi.Update
    Name                               MemberType
    ----                               ----------
    AdditionalInformationUrls            Property
    ArrivalDate                          Property
    CompanyTitles                        Property
    CreationDate                         Property
    DefaultPropertiesLanguage            Property
    Description                          Property
    HasEarlierRevision                   Property
    HasLicenseAgreement                  Property
    HasStaleUpdateApprovals              Property
    HasSupersededUpdates                 Property
    Id                                   Property
    InstallationBehavior                 Property
    IsApproved                           Property
    IsBeta                               Property
    IsDeclined                           Property
    IsEditable                           Property
    IsLatestRevision                     Property
    IsSuperseded                         Property
    IsWsusInfrastructureUpdate           Property
    KnowledgebaseArticles                Property
    LegacyName                           Property
    MsrcSeverity                         Property
    ProductFamilyTitles                  Property
    ProductTitles                        Property
    PublicationState                     Property
    ReleaseNotes                         Property
    RequiresLicenseAgreementAcceptance   Property
    SecurityBulletins                    Property
    Size                                 Property
    State                                Property
    Title                                Property
    UninstallationBehavior               Property
    UpdateClassificationTitle            Property
    UpdateServer                         Property
    UpdateSource                         Property
    UpdateType                           Property

    The PowerShell engine is doing a bit of magic for you because the authors of the UpdateServices module have specified a custom format view to allow for human consumption.

    If you open the custom format file "C:\windows\system32\windowspowershell\v1.0\Modules\UpdateServices\WsusCmdlets.format.ps1xml" of the UpdateServices module and search for "Microsoft.UpdateServices.Commands.WsusUpdate" you can find the calculated property.

    To get the same result with only selected properties you'll need to specify a calculated property for Title instead.

    Get-WsusUpdate -Approval Unapproved | Select-Object -First 10 -Property @{Name='Title';Expression={$_.Update.Title}}, Classification

    I hope above helps. Apologies for my long answer.


  • #60195

    Points: 1
    Rank: Member

    That worked. Thank you Ron & Daniel for the quick response. Special thanks to Daniel for the explanation.

    Thank you,

The topic ‘Filter Property Value’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort