Filter Property Value

This topic contains 3 replies, has 3 voices, and was last updated by  Tijo Thomas 10 months, 1 week ago.

  • Author
    Posts
  • #60187

    Tijo Thomas
    Participant

    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?

    Thanks,
    Tijo.

  • #60190

    Ron
    Participant

    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

    Daniel Krebs
    Moderator

    Hi,

    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.

    Best,
    Daniel

  • #60195

    Tijo Thomas
    Participant

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

    Thank you,
    Tijo.

You must be logged in to reply to this topic.