PowerShell

Download servicenow Incident attachment using PowerShell

Posted on

Of late I received a request to share a PowerShell script to download attachment(s) from the given servicenow incident. Two attachments are available for the sample incident INC0010008 below is the illustration. First we need to query incident by number to retrieve sys_id and through which we get the attachment metadata. Table name incident and table_sys_id are used respectively. […]

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 […]

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”, […]