Jump to content

Asset Owner import


Steve Giller

Recommended Posts

We are importing/updating assets using the asset import tool and SCCM.

We use the managedBy attribute in AD to store the asset's assigned owner, and can easily import this into Service Manager.
Before I do, my question is; will Service Manager recognise that the CN stored in that field is a user, or will it blindly try and shove the whole CN in there, probably returning a "too long" type error?

The Wiki states "h_owned_by":"[UserName]" - when a valid Hornbill User ID (for a Full or Basic User) is passed to this field, the user is verified on your Hornbill instance, and the tool will complete the h_owned_by and h_owned_by_name columns appropriately. however the User ID is the sAMAccountName, not the full CN.
 

Link to comment
Share on other sites

  • 2 weeks later...

Hi @DeadMeatGF

The utility will not automatically strip the full CN - it does need to be passed a user ID in the format of a Hornbill User ID for this to resolve correctly. 

In my example, I've created a SQL View that is being queried in my utility SQL statement - and the UserName column at the source is showing the user name in the format we have stored in Hornbill:

Screenshot_18.png

What the Wiki refers to is the fact that this is all that's needed to create the association between a user and an asset - i.e. the utility will take this, and perform a lookup within Hornbill to find the relevant user, populate the h_owned_by/h_used_by attribute with the relevant URN, and auto populate the h_owned_by_name/h_used_by_name with a users name - so that you don't have to try and create these strings/details in your SQL statement or view.

 

This is what h_cmdb_assets table looks like after the utility has imported the above asset:

Screenshot_17.png

I hope this clears this up!

Kind Regards

Bob Dickinson

 

Link to comment
Share on other sites

My problem (and to be fair, it is my problem!) is that we have a mixture of sAMAccountName formats from merging with other colleges, so I can't take the CN (which is currently all I have available) and manipulate it so that we have a recognisable Hornbill account name.

So taking the start of my CN (CN=steve.giller,OU=General User ...) I could create Giller_S quite easily, but (CN=matthew.peacock,OU=General User ...) would need to be converted to matthew.peacock and obviously you can't have both.

Is there any chance of moving the logic from the User Import that calculates the Manager's ID into the Asset Import and applying it to the owner as that seems to work fine?

Link to comment
Share on other sites

I've found a JOIN that I can do to pull back the sAMAccountName to match to the Service Manager UserID.
However this appears to be working sporadically (see screenshot)
Any ideas what I need to tweak to get this sorted, as some are working and appearing in the app as you would expect and others not, so there must be something I'm not doing quite right.

In the attached screenshot, Mark has been recognised and now has assets attached, whereas Matthew (owner) and David (user) have the correct IDs but haven't resolved to give names and attach to the assets.

Screenshot 2017-01-30 13.14.45.png

Link to comment
Share on other sites

Hi @DeadMeatGF,

So based on your most recent post I've performed a little more testing and I may have found an issue. But just to prove this, could I ask you to see if you experience the same result as me by performing a small test:

1) Pick one of your assets above (e.g. DC023331) - and edit the SQL in your .JSON file to only be selecting that particular asset (its easier to just work with a single asset than all of them)

2) Before running the utility, delete that asset from Hornbill

3) Run the utility - there should be a single asset created (the one you have deleted in the previous step)

4) Check the asset in  the Hornbill User App - the Used By and Owned By should be showing correctly. Then check the Database Direct - the h_used_by column should have a "URN" value stored e.g urn:sys:0:Barry Kearney:bmkearney

5) Back in the user app, make an amendment to one of the populated attributes e.g. Change the description. We simply want to force an update of the asset next time the utility is run

6) Run the utility again - the asset should have now been updated

7) Perform the same checks as in step (4).  I have noticed on my instance that the Used By and Owned By in the user app have now disappeared, and if you check the Database, the URN format has been overwritten by just the plain user ID

If you could do the same and let me know if you have similar results (which I believe you may do looking at the above screenshot), I can look into this further

Kind Regards

Bob

Link to comment
Share on other sites

  1. Check
  2. Check
  3. Check - one asset created
  4. Check - h_used_by, h_used_by_name, h_owned_by, h_owned_by_name all populated correctly
  5. Check - updated h_description field
  6. Check - one asset updated
  7. Check - h_used_by and h_owned_by contain the (correct) sAMAccountName but not the urn, h_used_by_name and h_owned_by_name contain the (correct) name (I assume they were untouched) and h_description has been updated back to the correct value.

Hope that helps.

Link to comment
Share on other sites

Hi @DeadMeatGF,

I've fixed this issue with the asset import tool, and this is now live as release v1.3.0 on our Github repository:

https://github.com/hornbill/goDBAssetImport

I've also added improved logging capabilities too the tool, as requested in the following post:

Let me know if I can be of any more assistance!

Steve

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...