Jump to content

Giuseppe Iannacone

Hornbill Users
  • Posts

    481
  • Joined

  • Last visited

  • Days Won

    7

Posts posted by Giuseppe Iannacone

  1. I was trying to update the expires date with the powershell module for hornbill, I've modified a script suggested in a post by @samwoo for disposal, but unfortunately it doesn't work.
    Can someone help me in understanding why?

    Script example

    # Import Hornbill XMLMC Powershell Module
    Import-Module D:\Asset_Hornbill\powershell\xmlmcModule.psm1

    # Import from CSV file, the Asset Name column should be called - "Name" - or it can be changed in the script below
    $pathToCSV = "[Path for csv file].csv"
    $warrantyAssets = Import-Csv -path $pathToCSV

    foreach($asset in $warrantyAssets)
    {
      # Get the Asset Name from the name column in the CSV
      $assetName = "$asset.name"
      $date = (get-date("2015-07-15 00:00:00")).toString("yyyy-MM-dd hh:mm:ss")
      write-host $assetName
      write-host $date

      # Define instance connection details & API key for session authentication
      $hbInstance ="instancename"
      $hbZone     = "eur"
      $hbAPIKey   = "APIkey"
      Set-Instance -Instance $hbInstance  -Key $hbAPIKey -Zone $hbZone

      # Build the API call to return the machines where the asset number matches in Hornbill
      Add-Param       "application"   "com.hornbill.servicemanager"
      Add-Param       "entity"        "Asset"

      Open-Element    "searchFilter"
        Add-Param       "column"    "h_name"
        Add-Param       "value"     $assetName
      Close-Element   "searchFilter"

      # Invoke XMLMC call, output returned as PSObject
      $hornbillAssetOutput = Invoke-XMLMC "data" "entityBrowseRecords2"
     
      # Convert the results of the API results into a workable format
      $hornbillAsset = $hornbillAssetOutput.Params.rowData.row

      # Update the Assets accordingly to warranty
      Add-Param       "application" "com.hornbill.servicemanager"
      Add-Param       "entity" "Asset"

      Open-Element    "primaryEntityData"

        Open-Element    "record"

          # Update the Asset matching the Name
          Add-Param       "h_name" $assetName

         
          # Set the Warranty expiration date
          Add-Param       "h_warranty_expires" $date
          
        Close-Element "record"

      Close-Element   "primaryEntityData"

      # Invoke XMLMC call, output returned as PSObject
      $xmlmcAssetUpdate = Invoke-XMLMC "data" "entityUpdateRecord"
    }

    # Important! Remove XMLMC module from memory for security once XMLMC calls complete
    Remove-Module xmlmcModule

     

  2. @James Ainsworth I'm referring to the Upload Asset from the Asset Management within Hornbill user app.
    we are using both tools for real, the idea is to use the upload asset in the asset management the very first time we bought a new computer and then keeping it update thanks to the import tool with the SCCM sync.
    My impression is that the UsedBy is filled but looking at the co-worker property there's no evidence that the asset is linked to him.
    For example this asset is used by V******a, but there's no evidence in its profile (My Asset section is missing)

    image.png.21649fc225b5aca972b26e293a6ebe20.pngimage.png.2e960d1a07b734c266a939bc75b075a4.png

     

  3. @Steve G sorry my request was not so clear. Is it clear to me that the tool will work fine with this criteria and if the serial number will be matched the asset will be updated. this is fine. I would like to have a validation criteria (like the upload csv tool has got) in the asset management generally speaking, this is to prevent an agent to create twice or more the same asset.
    Infact I was able to manually create a new asset with the same Serial Number and the tool updated the asset with the smallest ID (or at least this is my impression), so my request is referring to the admin side is there a setting that prevents a duplicate entry into the asset list ?
    image.png.5c3b2a1bc1f58ffdd21833fe4d8997ed.png

  4. @James Ainsworth is it working with your suggestions (I had to include the "Entity":"AssetsComputer" to be fully working), but my concern is that if i have a duplicate entry into the Asset Management it will update randomly the asset (I'm supposing the one with a lower ID number into the Hornibill db); I know that with the upload function you might have a validation rule, but an agent may always create a duplicate entry.

    Is there a setting that deny a duplicate entry based on a criteria? (for example the serialnumber)

  5. @James Ainsworth thank you James it was the first thing I've checked after posting, and i confirm is it working now. If i understand correctly the tool will validate the data based on the h_name field, but this may create duplicate entries if a pc is renamed into the domain, or am I wrong? is there a way to validate the data based on the pc serialnumber/servicetag?

    thank you by the way for the reply.

  6. we are experiencing issues with the asset management. using the hornbill tool for SCCM import we are able to retrieve data from the DB but when written on Hornbill they are all empty:

    image.thumb.png.6bb4f5dc994b7ffb0f521d494dbe4ebd.png

    here is the json configuration file (i've used XXXXX to the sensitive data)

    {
        "APIKey": "XXXXX",
        "InstanceId": "XXXXX",
        "LogSizeBytes": 1000000,
        "SQLConf": {
            "Driver": "odbc",
            "Server": "",
            "Database": "Asset_Hornbill",
            "Authentication": "",
            "UserName": "XXXXX",
            "Password": "XXXXXXXX",
            "Port": 0,
            "Encrypt": false,
            "Query": "SELECT OARSys.ResourceID AS [AssetID], OARSys.User_Name0 AS [UserName], OARSys.Netbios_Name0 AS [MachineName], OARSys.Resource_Domain_OR_Workgr0 AS [NETDomain], dbo.v_GS_OPERATING_SYSTEM.Caption0 AS [OperatingSystemCaption], OARSys.Operating_System_Name_and0 AS [OperatingSystem], dbo.v_GS_OPERATING_SYSTEM.Version0 AS [OperatingSystemVersion], dbo.v_GS_OPERATING_SYSTEM.CSDVersion0 AS [ServicePackVersion], dbo.v_GS_COMPUTER_SYSTEM.Manufacturer0 AS [SystemManufacturer], dbo.v_GS_COMPUTER_SYSTEM.Model0 AS [SystemModel], dbo.v_GS_PC_BIOS.SerialNumber0 AS [SystemSerialNumber], OAProc.MaxClockSpeed0 AS [ProcessorSpeedGHz], OAProc.Name0 AS [ProcessorName], dbo.v_GS_COMPUTER_SYSTEM.NumberOfProcessors0 AS [NumberofProcessors], dbo.v_GS_X86_PC_MEMORY.TotalPhysicalMemory0 AS [MemoryKB], dbo.v_GS_LOGICAL_DISK.Size0 AS [DiskSpaceMB], dbo.v_GS_LOGICAL_DISK.FreeSpace0 AS [FreeDiskSpaceMB], OAIP.IP_Addresses0 AS [IPAddress], OAMac.MAC_Addresses0 AS [MACAddress], dbo.v_GS_PC_BIOS.Description0 AS [BIOSDescription], dbo.v_GS_PC_BIOS.ReleaseDate0 AS [BIOSReleaseDate], dbo.v_GS_PC_BIOS.SMBIOSBIOSVersion0 AS [SMBIOSVersion], dbo.v_GS_SYSTEM.SystemRole0 AS [SystemType], OASysEncl.ChassisTypes0 AS [ChassisTypes], OASysEncl.TimeStamp AS [ChassisDate], OARSys.AD_Site_Name0 AS [SiteName] FROM dbo.v_R_System OUTER APPLY (SELECT TOP 1 * FROM dbo.v_R_System b WHERE b.Netbios_Name0 = dbo.v_R_System.Netbios_Name0 ORDER BY SMS_UUID_Change_Date0 DESC) OARSys OUTER APPLY (SELECT TOP 1 dbo.v_GS_SYSTEM_ENCLOSURE.* FROM dbo.v_GS_SYSTEM_ENCLOSURE WHERE dbo.v_GS_SYSTEM_ENCLOSURE.ResourceID = dbo.v_R_System.ResourceID ORDER BY TimeStamp DESC) OASysEncl OUTER APPLY (SELECT TOP 1 IP_Addresses0, ROW_NUMBER() OVER (order by (SELECT 0)) AS rowNum FROM dbo.v_RA_System_IPAddresses WHERE dbo.v_RA_System_IPAddresses.ResourceID = dbo.v_R_System.ResourceID ORDER BY rowNum DESC) OAIP OUTER APPLY (SELECT TOP 1 MAC_Addresses0 FROM dbo.v_RA_System_MACAddresses WHERE dbo.v_RA_System_MACAddresses.ResourceID = dbo.v_R_System.ResourceID ) OAMac OUTER APPLY (SELECT TOP 1 MaxClockSpeed0, Name0 FROM dbo.v_GS_PROCESSOR WHERE dbo.v_GS_PROCESSOR.ResourceID = dbo.v_R_System.ResourceID ORDER BY TimeStamp DESC) OAProc LEFT JOIN dbo.v_GS_X86_PC_MEMORY ON dbo.v_GS_X86_PC_MEMORY.ResourceID = dbo.v_R_System.ResourceID LEFT JOIN dbo.v_GS_OPERATING_SYSTEM ON dbo.v_GS_OPERATING_SYSTEM.ResourceID = dbo.v_R_System.ResourceID LEFT JOIN dbo.v_GS_COMPUTER_SYSTEM ON dbo.v_GS_COMPUTER_SYSTEM.ResourceID = dbo.v_R_System.ResourceID LEFT JOIN dbo.v_GS_PC_BIOS ON dbo.v_GS_PC_BIOS.ResourceID = dbo.v_R_System.ResourceID LEFT JOIN dbo.v_GS_LOGICAL_DISK ON dbo.v_GS_LOGICAL_DISK.ResourceID = dbo.v_R_System.ResourceID LEFT JOIN dbo.v_FullCollectionMembership ON (dbo.v_FullCollectionMembership.ResourceID = v_R_System.ResourceID) LEFT JOIN dbo.v_GS_SYSTEM ON dbo.v_GS_SYSTEM.ResourceID = dbo.v_R_System.ResourceID WHERE dbo.v_GS_LOGICAL_DISK.DeviceID0 = 'C:' AND dbo.v_FullCollectionMembership.CollectionID = 'SMS00001' "
        },
        "AssetTypes": [{
                "AssetType": "Server",
                "Query": "AND OASysEncl.ChassisTypes0 IN (2, 17, 18, 19, 20, 21, 22, 23)",
                "AssetIdentifier": {
                    "DBColumn": "SystemSerialNumber",
                    "Entity": "AssetsComputer",
                    "EntityColumn": "h_serial_number"
                }
            }
        ],
        "AssetGenericFieldMapping": {
            "h_name": "[MachineName]",
            "h_site": "[SiteName]",
            "h_asset_tag": "[MachineName]",
            "h_acq_method": "",
            "h_actual_retired_date": "",
            "h_beneficiary": "",
            "h_building": "",
            "h_cost": "",
            "h_cost_center": "",
            "h_country": "",
            "h_created_date": "",
            "h_deprec_method": "",
            "h_deprec_start": "",
            "h_description": "[MachineName] ([SystemModel])",
            "h_disposal_price": "",
            "h_disposal_reason": "",
            "h_floor": "",
            "h_geo_location": "",
            "h_invoice_number": "",
            "h_location": "",
            "h_location_type": "",
            "h_maintenance_cost": "",
            "h_maintenance_ref": "",
            "h_notes": "",
            "h_operational_state": "",
            "h_order_date": "",
            "h_order_number": "",
            "h_owned_by": "[UserName]",
            "h_product_id": "",
            "h_received_date": "",
            "h_residual_value": "",
            "h_room": "",
            "h_scheduled_retire_date": "",
            "h_supplier_id": "",
            "h_supported_by": "",
            "h_used_by": "[UserName]",
            "h_version": "",
            "h_warranty_expires": "",
            "h_warranty_start": ""
        },
        "AssetTypeFieldMapping": {
            "h_name": "[MachineName]",
            "h_mac_address": "[MACAddress]",
            "h_net_ip_address": "[IPAddress]",
            "h_net_computer_name": "[MachineName]",
            "h_net_win_domain": "[NETDomain]",
            "h_model": "[SystemModel]",
            "h_manufacturer": "[SystemManufacturer]",
            "h_cpu_info": "[ProcessorName]",
            "h_description": "[SystemModel]",
            "h_last_logged_on": "",
            "h_last_logged_on_user": "",
            "h_memory_info": "[MemoryKB]",
            "h_net_win_dom_role": "",
            "h_optical_drive": "",
            "h_os_description": "[OperatingSystem]",
            "h_os_registered_to": "",
            "h_os_serial_number": "",
            "h_os_service_pack": "[ServicePackVersion]",
            "h_os_type": "",
            "h_os_version": "[OperatingSystemVersion]",
            "h_physical_disk_size": "[DiskSpaceMB]",
            "h_serial_number": "[SystemSerialNumber]",
            "h_cpu_clock_speed": "[ProcessorSpeedGHz]",
            "h_physical_cpus": "[NumberofProcessors]",
            "h_logical_cpus": "",
            "h_bios_name": "[BIOSDescription]",
            "h_bios_manufacturer": "",
            "h_bios_serial_number": "",
            "h_bios_release_date": "[BIOSReleaseDate]",
            "h_bios_version": "[SMBIOSVersion]",
            "h_max_memory_capacity": "",
            "h_number_memory_slots": "",
            "h_net_name": "",
            "h_subnet_mask": ""
        }
    }

     

  7. 3 hours ago, ArmandoDM said:

     

    Hello @Giuseppe Iannacone

    is the BPM operation triggered after completing a task ?

    Cheers

    Armando

    @ArmandoDM after restarting the process on the reload icon on the hud bar the process have restarted but the task were cancelled (?!?)

    @James Ainsworth this is a good suggestion but very time consuming, I don't know when i will be able to perform this task. Do you suggest to enable this setting only for a limited time for the troubleshooting or leave it turned on anyway?

    thank you

×
×
  • Create New...