Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Retrieve value from computer via powershell ans put it in inventory

Hi,

I wanted to retreive the Windows Defender signature version and the date it was last updated. I can retrieve this via a registry scan. The update date is in binary format so this is pretty useless in this form. Is there a way to return a value via powershell, for instance via this command:

[datetime]::FromFileTime([BitConverter]::ToInt64((Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows Defender\Signature Updates').SignaturesLastUpdated,0))

and put this in a custom field or variable, or some other place so that I can build a collection with it?

regards,

Guy

1

Comments

1 comment
Date Votes
  • We are planning on adding a PowerShell scanner to PDQ Inventory that would allow you to do things like this, but I have no ETA on when it will be ready. In the meantime, one thing you can try is to write a PowerShell script that stores your converted data in WMI, run that script with Deploy, and set the Scan Profile on that package to a WMI scanner.

    Here's a rough proof-of-concept script I found in my notes for storing data in WMI:

    # https://social.technet.microsoft.com/Forums/exchange/en-US/183b8b56-131c-4de7-80bc-08650daf7333/wmi-custom-class-with-powershell?forum=ITCG

    param (
    [string]$ClassName,
    [array]$Properties,
    [string]$Namespace = "root\CIMV2"
    )

    $NewClass = New-Object System.Management.ManagementClass("$Namespace", [String]::Empty, $null)

    $NewClass["__CLASS"] = "$ClassName"
    $NewClass.Qualifiers.Add("Static", $true)

    ForEach ( $Property in $Properties ) {

    $NewClass.Properties.Add("$Property", [System.Management.CimType]::String, $false)
    $NewClass.Properties["$Property"].Qualifiers.Add("Key", $true)

    }

    $NewClass.Put()
    1