Client Management Suite

 View Only
  • 1.  Custom Inventory Help needed

    Posted Feb 04, 2022 02:59 PM
    Hi guys
    I'm working on custom inventory to collect the status of a Windows Services on a server. For example, I want to know if the status of the Windows Update services on a server. I would like to get a custom inventory to get this data, so I wrote this, but it's running sucessfully but the data is not showing up on the custom data class of the server. Any idea? also opened to do it on a easier way if there is. one.





    Here is the script: 

    $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("{9a77ee87-eadf-4d18-a07b-04e31063c4aa}")

    $objDataClass = $nse.AddDataBlock($objDCInstance)

    $status = get-service wuauserv

    $objDataRow = $objDataClass.AddRow()
    $objDataRow.SetField(0, $status)

    #Send the data
    $nse.sendqueued()



  • 2.  RE: Custom Inventory Help needed

    Posted Feb 05, 2022 10:49 AM
    Alex, 

    You do not need to do a custom inventory for this.  Windows services are already included as an item within Inventory solution.  Check this location on one of your machines. 




    If you've not gathered this inventory you can trigger it via "Hardware and OS" inventory

    ------------------------------
    Joe
    ------------------------------



  • 3.  RE: Custom Inventory Help needed

    Broadcom Employee
    Posted Feb 07, 2022 03:57 AM
    Edited by Igor Perevozchikov Feb 07, 2022 06:53 AM
      |   view attached

    Agree with JOE.PS1 that there is no need to use custom inventory, just create own custom report to get this existing info from database.

    You try this custom report which gets data from Inventory Solution "Inv_OS_Service_Windows" data class

    Use attached "Windows Update_ service status from Inventoried computers.xml" and import it in "Reports" folder from SMP Console

    Also another information about Windows Update service can be checked from "Inv_AeX_AC_NT_Services" data class, where data is updated after each basic inventory sending from managed client computers

    Use attached "Windows Update_ service information from basic inventory.xml" and import it in "Reports" folder from SMP Console


    Best regards,
    IP.



    ------------------------------
    [JobTitle]
    [CompanyName]
    [State]
    ------------------------------



  • 4.  RE: Custom Inventory Help needed

    Broadcom Employee
    Posted Feb 07, 2022 06:56 AM
    Edited by Igor Perevozchikov Feb 07, 2022 06:55 AM
    Added attachments

    ------------------------------



  • 5.  RE: Custom Inventory Help needed

    Broadcom Employee
    Posted Feb 08, 2022 08:10 PM
    For your original script, you can comment out the nse.sendqueued() and add echo $nse to troubleshoot your powershell script. For yours, it looks like an ivalid data type for the the line with $objDataRow.SetField(0, $status).

    Here is a VBScript to get it going if you want to go the custom inventory route. Note for local testing, the command at the end displays a portion of the collected data (MsgBox nse.xml). Be sure to comment that out or delete it prior to adding to your script task. And uncomment nse.send.

    '*****************************************************************************
    '* This vbscript gets status info from a specified service
    '*****************************************************************************
    set objFSO = CreateObject("Scripting.FileSystemObject")
    Set wshShell = WScript.CreateObject( "WScript.Shell" )
    strComputerName = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
    dim nse
    set nse = WScript.CreateObject ("Altiris.AeXNSEvent")
    ' Set the header data of the NSE. Please don't modify this GUID
    nse.To = "{1592B913-72F3-4C36-91D2-D4EDA21D2F96}"
    nse.Priority = 1
    dim objDCInstance
    ' CHANGE this GUID to match the custom data class GUID from the Notification Server Console
    set objDCInstance = nse.AddDataClass ("{1be7b399-3643-4915-89da-c4d07570ffaf}")
    dim objDataClass
    set objDataClass = nse.AddDataBlock (objDCInstance)
    dim objDataRow
    set objDataRow = objDataClass.AddRow

    Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
    Set colRunningServices = objWMIService.ExecQuery("select * from Win32_Service where Name = 'wuauserv'")
    found = 0
    For Each objService in colRunningServices
    objDataRow.SetField 0, CStr(strComputerName)
    objDataRow.SetField 1, objService.Name
    objDataRow.SetField 2, objService.State
    objDataRow.SetField 3, objService.StartMode
    objDataRow.SetField 4, cstr(Now)
    found = 1
    Next
    if found = 0 then
    objDataRow.SetField 0, CStr(strComputerName)
    objDataRow.SetField 1, "Service not found"
    objDataRow.SetField 2, "N/A"
    objDataRow.SetField 3, "N/A"
    objDataRow.SetField 4, cstr(Now)
    end if
    'nse.Send
    MsgBox nse.Xml