Node JSWindows PowerShell

Query Service-now CMDB to retrieve Contact Information using PowerShell, SNOW REST API and Node JS

In this blog post I will walk you through the solution I implemented by building “RESTful” for “REST” API. Sounds weird right? Yes, this is a challenge I faced at ac client environment! For a business reason team decided to customize the servicenow endpoints. So, as expected dependency in increased along with that technical challenges.

I feel CMDB module is easier in servicenow than others like Request, Request Item, etc . However we need to do multiple query in order to retrieve CMDB information especially for contact.

  1. Send Request to retrieve parent configuration item.
  2. Through parent CI query primary and secondary owner information.

Our goal is to achieve

and get output as illustrated below

Here is the PowerShell script which does the job!

For my client we need to host the REST API through Layer 7 (Security). That’s the reason code use proxy authorization! Ideally Proxy Authentication is not required. Now, comes the question

“Why are we building RESTful API for available REST?”

I need to fuse this solution with .NET MVC portal and a third party orchestrator. Yes, I can call C# for MVC and use PowerShell for orchestration automation engine. But, it’s not straightforward approach and time consuming. So, I added a route in existing microservice which made a quicker deployment.

Here, is what I did in node!

In short, we query the cmdb table with the given host which yields the parent CI link. Through that we retrieve primary and secondary contact information. In SNOW owner information are stored like a profile link.

Enjoy PowerShell!


Leave a Reply

Your email address will not be published. Required fields are marked *