Node JS

TIP: Node JS PUG Conditionals

Posted on

Recently I was working on a tiny project in which I need to make text field as READONLY when it’s backfilled by query and FREE TEXT if empty. Yes, as you guessed I use PowerShell a lot at my workplace. Having said that, let me show case the demo using PowerShell and Node JS Scenario […]

PowerShell

TIP: Using TrueSight QueryEventByID and RetrieveQueryResults Complex Types in PowerShell

Posted on

Recently I was working on piece of code which retrieves TrueSight alert information. I got stuck with “Invalid Long Type:” – Doesn’t make sense right? Come lets see it detail! Consider you have an alert ID like “mc.pncell_[HOSTNAME].1a5ed3bb.0” using the below snippet you can retrieve the result (resultHandle) param ( $AlertID ) try { $Url = […]

PowerShell

Tip: Retrieve servicenow CI item values using REST API (Turn on Display Value)

Posted on

In my last blog post I shared about ‘Scripted REST API’ getDisplayValue() tip. Now, here lets see Out of the Box option. When we query the CI with a query “sysparm_query=name=$($ConfigurationItem)&sysparm_limit=1” param ( $ConfigurationItem = ‘Car-3’ ) try { $Uri = “https://dev42835.service-now.com/api/now/table/cmdb_ci?sysparm_query=name=$($ConfigurationItem)&sysparm_limit=1” $admin = “admin” $password = “admin” | ConvertTo-SecureString -AsPlainText -Force $Credential = New-Object pscredential […]

PowerShell

Create VSTS Build Definitions using PowerShell

Posted on

For my current project assignment I was asked to share a PowerShell script which creates VSTS build + phase dynamically. To make this blog short let me show a simple build definitions sample. With no wait here is the code $Token = “Personal Access Token” $Authentication = [Text.Encoding]::ASCII.GetBytes(“:$Token”) $Authentication = [System.Convert]::ToBase64String($Authentication) $Headers = @{ Authorization […]

servicenow

Tip: Create Scripted REST API in servicenow and consume it in PowerShell

Posted on

In this blog post let me walk through the simple steps to create a “Scripted REST API” which simply prints the hardcoded values. This is a beginners guide so let’s keep things easier! Navigate here to get some more information. { “Name”: “Chendrayan Venkatesan (Chen V)”, “Role”: “ITPro”, “Department”: “Information Technology”, “Skills”: [ “PowerShell”, “REST”, “servicenow”, […]

Windows PowerShell

TIP: Query servicenow Incident record using PowerShell and REST API

Posted on

In order to query the servicenow incident records and to list out the required fields use the sysparm_fields column which helps in optimization. Now,  See the code, result and performance All Fields function Get-ServiceNowIncident { [CmdletBinding()] param ( [Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] $IncidentID, [Parameter(Mandatory)] [pscredential] $Credential ) try { $Uri = “https://dev42835.service-now.com/api/now/table/incident?sysparm_query=number=$($IncidentID)” $Result = Invoke-RestMethod -Uri […]