Home Asset Management

Asset skipped devices and other issues.

Tim_VottaTim_Votta Customer Adept IT Monkey ✭✭
I am not sure if my expectations for how things are supposed to work may be incorrect; I might just be doing things wrong.  I am having a similar issue to the problem in this thread https://community.cireson.com/discussion/1668/skipped-device-in-synchardwareassets-log#latest  However, I only have 1 AD forest, so I don't think it is identical.  I have confirmed that the AD SID for the items listed as being skipped are indeed blank though.


For asset tracking, we want to track all of our user workstations as well as all of our servers (mostly VMs.)  For workstations, we import all of our inventory into Asset Management when we receive the hardware.  We set the Asset Name, Serial Number and HW Asset ID to the serial number of the system.  Now when we deploy a workstation, the hardware asset already exists when SCCM scans it for the first time.  The Asset workflows go and rename the the asset to match to computer name, this has been working perfectly fine for us so far.  

However, when we deploy a server the serial number is not known ahead of time.  In that instance, we want Asset Management to create the hardware asset for us after the SCCM connector runs overnight.  This is not happening right now.  The Hardware sync log indicates that it is not the most recent computer with that SID (it is just a blank SID,) so it never makes the asset.

If I go into the HW Sync workflow settings and uncheck the box next to "Before creating, check for existing windows computer..." then it will create the HW assets for the items I am missing.  However, we rename computers frequently so I think that turning that off would just introduce a new set of problems.

We are only importing computers from our SCCM connector.  Our AD connectors do users only.  I forget why we had done it that way, but I think it was recommended to not import computers from both locations.


Is it possible to have the Assets created automatically for our servers in this scenario?
Should we be using an AD connector for computer objects?  What happens if we are also running the SCCM connector?


Best Answer

Answers

  • Tim_VottaTim_Votta Customer Adept IT Monkey ✭✭
    That did the trick, but it pulled in and created assets for a lot of things that I don't want in there.  Our SQL Cluster DNS names and that type of thing all made assets now as well.

    I think we are probably going to go the route of manually creating an asset with the serial number of the VM just to keep less noise from being generated and needing to get cleaned up.
  • Brett_MoffettBrett_Moffett Cireson PACE Super IT Monkey ✭✭✭✭✭
    There is also no reason that you can not run multiple connectors for ConfigMgr and AD.
    This way you get to target the collections or OU's that you wish to target and even filter AD Objects with LDAP queries so you are only pulling in the CI's that you want to. This also effects the licensing count that Microsoft (and Cireson) uses to calculate your license costs.

    In an average environment I might usually set up 5 or 6 AD connectors targeting different OU's or queries depending on the customers OU layout.

    Hope this helps
  • Robert_OsterbergRobert_Osterberg Customer Adept IT Monkey ✭✭
    @Brett_Moffett
    Is is possible to do a full resync of alla HWA like a reinstall of ITAM or if you could delete all objects and let the sync create the again? I also had som stuff n my DB that i didn`t want so. Or can you simply go into the DB and delete all objects from the HardwareAsset Table and let them resync?
  • Brett_MoffettBrett_Moffett Cireson PACE Super IT Monkey ✭✭✭✭✭
    Yes, it's absolutely possible to do this and I do it from time to time.
    Your best bet is usually PowerShell as it will remove relationships as well so there are no dead links in other tables of the DB.

    Then it is just a case of waiting for the CAM Workflow to run again and it should re-create the assets based ont he settings you have made in the CAM settings.

    Good luck
  • Robert_OsterbergRobert_Osterberg Customer Adept IT Monkey ✭✭
    @Brett_Moffett
    Thx for your reply. So I did go ahead and deleted all items but i think there is still stuff left in the DB because when the WF runs i get some NULL refrence exceptions. Maybe it is becasue i deleted it all from within the DB. Do you have any good PS code that can get it done? also i wan`t to know if removing all MPs that are installed can do the same thing because if i did this the wrong way i want to start over.

    Thx again
  • Brett_MoffettBrett_Moffett Cireson PACE Super IT Monkey ✭✭✭✭✭
    Now that you have removed items directly from the DB the PowerShell code will not work as it relies on the SCSM SDK to track each item and it's relationships.
    Removing the MP's would remove the tables from the DB and therefore wipe out the relationships etc. However, I'm not sure about the relationships to existing CI's such as Computers, Users, Work Items etc.

    If this is a production system then I'd suggest getting one of our Cireson Consulting Services engineers to setup a call with you to work through the steps needed, or if this is a SCSM 2012 environment and you are planning to upgrade to 2016, I'd suggest a migration using the Life-cycle Management App that should leave all the old noise behind.

    Hope that helps.
  • Robert_OsterbergRobert_Osterberg Customer Adept IT Monkey ✭✭
    @Brett_Moffett
    I did this in my test env so it is no big deal. But to get fresh new data into our PROD env when we migrate everything we done in our ITAM HW project it would be of great value if you could share your PS code so if i did this again i do it right this time ;)
    Thx for your quick answers
  • Brett_MoffettBrett_Moffett Cireson PACE Super IT Monkey ✭✭✭✭✭
    So I thought I'd walk you through how to use SMLETS to achieve what you are after. It's way longer than just giving you the final line of code, but hopefully it explains a few things for a few people.

    First we need to select the Asset configuration item we want to remove. This code will return a single asset with the filter property set to the name of the Asset.
    <b>Get-SCSMObject</b> -class (<b>Get-SCSMClass</b> -Name "Cireson.AssetManagement.HardwareAsset") -Filter {Displayname -eq "<i>AssetNameGoesHere</i>"}
    If you want to return ALL your Assets, then simply drop the filter.
    <b>Get-SCSMObject</b> -class (Get-SCSMClass -Name "Cireson.AssetManagement.HardwareAsset")
    The next thing we need to do is remove the Configuration Item. To remove Configuration Items, or Work Items for that matter, we use the Remove-SCSMObject command. The only input we need is the actual object itself with the -smobject property. This is given to us from the previous Get-SMObject command.
    If it was just the one asset we wanted to remove, we might save the value to a variable for ease of reading and it would end up like this:
    <b>Remove-SCSMObject</b> -smobject $AssetGoesHere
    Or we could put it all on one like this:
    <b>Remove-SCSMObject</b> -smobject (<b>Get-SCSMObject</b> -class (<b>Get-SCSMClass</b> -Name "Cireson.AssetManagement.HardwareAsset") -Filter {Displayname -eq "<i>AssetNameGoesHere</i>"})
    Now, one more thing we need to know about SCSM is that when you delete an item, it doesn't actually get deleted. It just gets a value changed on the Database table that hides the item. It sets the ToBeDeleted value to True. This no longer shows in the console in any of the regular views, however, it does show up in the Deleted Items node under the Administration workspace.
    So to remove it from the DB all together, we need to add the -force property to the Remove Object command.
    <b>Remove-SCSMObject</b> -smobject (<b>Get-SCSMObject</b> -class (<b>Get-SCSMClass</b> -Name "Cireson.AssetManagement.HardwareAsset") -Filter {Displayname -eq "<i>AssetNameGoesHere</i>"}) -force
    OK, so that removes the one instance of a CAM Hardware Asset CI.

    But what if we want to remove ALL the CAM Hardware Assets?

    Then you can swap the two commands so PowerShell runs the Remove-SCSMObject comand for each of the CI's that are returned from the search.
    The command then looks like this:
    <b>Get-SCSMObject</b> -class (Get-SCSMClass -Name "Cireson.AssetManagement.HardwareAsset") | <b>Remove-SCSMObject</b> -smobject -force
    You now have the power......  but with great power....  comes great responsibility! :)

    Be careful, this code WILL DELETE DATA!!
    Make sure it's the data you want to delete before you pull the trigger.

  • Robert_OsterbergRobert_Osterberg Customer Adept IT Monkey ✭✭
    @Brett_Moffett
    THX alot this will help a great deal.
  • Robert_OsterbergRobert_Osterberg Customer Adept IT Monkey ✭✭
    @Brett_Moffett
    So just to clarify this method of deleting HWA will also delete any relationships that the HWA has in a correct way so the HardwareAssetSync can recreate the HWA in CAM? 
  • Brett_MoffettBrett_Moffett Cireson PACE Super IT Monkey ✭✭✭✭✭
    Correct.
    As the PowerShell command uses the SDK to to the work, all the relationships are removed also.
Sign In or Register to comment.