Home General Discussion

Asset Management how to set Hardware warranty period from PowerShell

Stephane_BouillonStephane_Bouillon Customer Adept IT Monkey ✭✭

I'm attempting to update our hardware asset information based on an excel from our vendor. It identifies for every item we purchased over the years the Serial Number and a few other columns, such as the warranty start and end dates.

I noticed that I can manually update an item to point to the correct catalog item, but the start and end dates for the warranty are greyed out. I first need to create a warranty object. How does this work ? Our material has a standard 3 year warranty based on the Delivery date.

Another question is, how can I go over the excel in PowerShell, find the Hardware Asset with a matching Serial Number, and then update the Catalog Item and other fields ?

This is all new to me, so I may be going about this in a totally wrong way ?


  • Justin_WorkmanJustin_Workman Cireson Support Super IT Monkey ✭✭✭✭✭
    You can create a Warranty in the Console under Configuration Items/Asset Management/Contracts.  I'm not sure I quite understand what you're meaning with "go over excel in Powershell".  You can use Asset Excel to create/edit assets(or warranties for that matter!).  You can also use Asset Import to create a connector based on this spreadsheet you're talking about.  You just map the existing fields to Hardware Asset fields.  
  • Adam_DzyackyAdam_Dzyacky Product Owner Contributor Monkey ✭✭✭✭✭
    Lot to unpack here, but if the perspective is "all new to me" I'll try to address some of this at a more fundamental level in SCSM.

    First - probably the most overused analogy, but one I'm still going to use is that everything in SCSM comes down to cookie cutters and cookies...or rather Classes and Objects respectively. So there is the Cireson Asset Management Warranty class, Hardware Asset class, Catalog Item class, etc. etc. Those classes are really a definition of sorts, so that every object you stamp out generally looks the same but still is unique in its own way. Based on this SCSM architecture + how Cireson has built out Asset Management you're correct in that you would need a Warranty object and then relate it to a Hardware Asset.

    The reason behind this more than likely is that you may relate a Warranty to one or many Hardware Assets. You may update this warranty independently of the Hardware Assets. So if anything, this is really done from a saving some administrative overhead in SCSM. That said, there certainly is some setup time as you're no doubt experiencing but it's setup time and setup time alone.

    Second - PowerShell over Excel. You can do it, but a CSV is far simpler. Not only because PowerShell features the native "Import-CSV" cmd-let but because if its a CSV you can use the Cireson Asset Import Connector to read that CSV and create objects of a particular class.

    Last - I could just be misreading it, but it sounds like you may be missing how Catalog Items and Hardware Assets play together. In short it's another "cookie cutter" style analogy, but in practice your Catalog Items are things like "Cisco RV325". The Catalog Item is nothing more than a record of "I have this thing in my environment" within SCSM. The Hardware Asset is each individual instance of that thing within your environment. So you'd have a single Catalog Item related to one or many Hardware Assets. With this said, part of Cireson Asset Management is to automatically related Hardware Assets to Catalog Items one some defined schedule based on a like make/model. But I will say that this built in Cireson workflow only works against Computer objects, you'd have to create custom workflows to manage other Configuration Items in your environment for the automatic matching to work. Here's an example of one such custom script.

    I think the best advice to offer around Asset Management within SCSM if you're going at it alone or in a small team, is to focus on getting objects loaded first, then move on to how they relate to one another. Oh and in dev :)
  • Stephane_BouillonStephane_Bouillon Customer Adept IT Monkey ✭✭
    I got a CSV from Dell with a row for each computer item we ever purchased, so with the following columns:

    SvcTag (serial number), Model, Warranty Start Date, Warranty End Date

    What I want to do is to go over this csv in PowerShell, and for each item that has a corresponding item in my CMDB - meaning a computer with the same serial number - I want to update the Warranty Start Date and Warranty End Date. I don't want to create or update computers that are not already in the CMDB as these would be machines that are no longer active and probably decommissioned some time ago (as reported by SCCM).

    Makes sense ?
  • Adam_DzyackyAdam_Dzyacky Product Owner Contributor Monkey ✭✭✭✭✭
    edited July 2018
    Sounds like...

    $csv = import-csv "asset.csv"
    foreach ($item in $csv)
    $hwClass = get-scsmclass -name "cireson.assetmanagement.hardwareasset$"
    $warrantyClass = get-scsmclass -name "cireson.assetmanagement.warranty$"
    $hwHasWarrantyRelClass = get-scsmrelationshipclass -name "Cireson.AssetManagement.HardwareAssetHasWarranty"
    $hwObject = get-scsmobject -class $hwClass -filter "AssetTag -eq $item.SvcTag"
    $warrantyPropHash = @{"Properyname1" = "value1"; "PropertyName2" = "Value2"}

    if ($hwObject)
    $newWarranty = new-scsmobject -class $warrantyClass -propertyhashtable $warrantyPropHash -passthru
    New-SCSMRelationshipObject -Source $hwObject -Relationship $hwHasWarrantyRelClass -Target $newWarranty -Bulk

    Now you'll have to update the $warrantyPropHash, but this I think is the general idea of what you're after.

  • Stephane_BouillonStephane_Bouillon Customer Adept IT Monkey ✭✭
    Yes, your other script also helped me get started. What I still don't understand though is why I would create a warranty object for each hardware asset, when I only need to add the Warranty Start & End Date to the asset.

  • Adam_DzyackyAdam_Dzyacky Product Owner Contributor Monkey ✭✭✭✭✭
    You don't have to create a warranty object for each hardware asset. The script is just a guide/general way you could go about this.

    You could modify it to instead of create new warranty object, just relate them. All it would take is defining the static warranty object outside of the loop and then relating within the loop.
  • Stephane_BouillonStephane_Bouillon Customer Adept IT Monkey ✭✭
    If I have a static warranty object to which all Dell computers are related, can I still have a different WarrantyStartDate and WarrantyEndDate for each hardware asset ? Sorry if it's a dumb question.
  • Justin_WorkmanJustin_Workman Cireson Support Super IT Monkey ✭✭✭✭✭
    You can use a Master warranty.  Once you set the Received Date for the Hardware Asset, the warranty period will start from that date.  If you set the Warranty Start date, it will start from that date still using the Master duration.
  • Stephane_BouillonStephane_Bouillon Customer Adept IT Monkey ✭✭
    Ok, I created a few warranty master contracts, Dell Standard 1Y, Dell Standard 3Y, Dell Standard 4Y and Dell Standard 5Y, and then will associate the right period to every Dell Asset in our environment by matching the Serial Number of the asset to the row in the file I got from Dell.

    Thanks for your assistance
  • Stephane_BouillonStephane_Bouillon Customer Adept IT Monkey ✭✭
    What is the Relationship or difference between the Received Date and the Warranty Start Date ? The Cireson portal doesn't show the Warranty Start and Warranty End Date even though the Received Date is set.

    I'd like to show the Warranty End Date in the All Hardware Assets overview.
Sign In or Register to comment.