Client Management Suite

 View Only

Inventory - Powershell Script

  • 1.  Inventory - Powershell Script

    Posted Sep 17, 2012 02:56 AM

    I have am trying to write a powershell script to query a registry key and post it to a custom data class I have created.

    Attributes for the Custom data class are the same as registry "WarrantyExpiry" & "date" Correct Data Class guid (I made sure to put the changed guid in the script after the dataclass was edited)

    Script runs but nothing is posted back to the NS, even though registry key exists on the client is there another line of code?

    #************************DO NOT EDIT********************************
    nse = new-object -comobject Altiris.AeXNSEvent
    $nse.priority = 1
    $nse.To = "{1592B913-72F3-4C36-91D2-D4EDA21D2F96}"
    #************************DO NOT EDIT********************************

    #Modify this varaible with the custom data class guid
    $objDCInstance = $nse.AddDataClass("{f8f56fab-3109-4b39-b013-ac171dc91661}")

    $objDataClass = $nse.AddDataBlock($objDCInstance)

    # PowerShell Registry Key
    $Registry_Key = "HKLM:\Software\DellWarranty"
    Get-ItemProperty -path $Registry_Key -name WarrantyExpiry

    #Add new row of data
    $objDataRow = $objDataClass.AddRow()
    $objDataRow.SetField(0, $path)
    }

    #Send the data
    $nse.sendqueued()