PowerShell Script

Handian Sudianto 5,981 Reputation points
2023-08-25T02:21:25.6+00:00

Hello,

I want to filter result of 'Get-MpComputerStatus' to be only showing AntivirusSigantureAge

I modify the powershell script to be

$age=Get-MpComputerStatus |Select-Object -Property AntivirusSignatureAge $age

but the result is

User's image

Anyone know how to filter so the powershell result only shoqing value (0) without 'AntivirusSignature' and '--------------' ?

PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,909 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ian Xue-MSFT 41,691 Reputation points Microsoft External Staff
    2023-08-25T03:51:19.55+00:00

    Hi,

    You can use the "-ExpandProperty" parameter.

    $age=Get-MpComputerStatus |Select-Object -ExpandProperty -Property AntivirusSignatureAge
    

    Or use the member access operator ".".

    $age=(Get-MpComputerStatus).AntivirusSignatureAge
    

    Best Regards,

    Ian Xue


    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.