**** This entire article now available as a white paper for download here >>  ****


It’s potentially possible to write your own workflow for ServiceDesk Plus using external scripts to interact with the ServiceDesk Plus API. There are various scripting languages we could use but, for simplicity, I’m going to use Microsoft PowerShell. PowerShell is widely recognised and should be readily available on Windows servers running ServiceDesk Plus.


In order to run PowerShell scripts on your Windows server it may be necessary to change the default PowerShell script execution policy. The Set-ExecutionPolicy cmdlet enables you to determine which Windows PowerShell scripts (if any) will be allowed to run on your computer. To execute search for the PowerShell application on your windows system:

 

APIPart3_1

Right-click ‘Windows PowerShell’ and choose the ‘Run as administrator’ option to bring up the PowerShell command line. Then enter the command ‘set-executionpolicy unrestricted’; you will be asked to accept the policy change by typing ‘Y’ as shown below:

APIPart3_2

You can always use a basic text editor to generate a PowerShell script but running the Windows PowerShell Integrated Scripting Environment (ISE) can be very useful as it provides a means to easily write, test and debug PowerShell scripts:


APIPart3_2






When you write a script it is important to locate the file in the correct folder location on the ServiceDesk Plus server. Generally the best place to store them is in,
 
[ServiceDesk Plus Home Folder]integrationcustom_scripts
 
If you return to this folder after running some scripts you may notice some additional folders such as ‘Request’. These folders are used to temporarily store any data output from ServiceDesk Plus.

So how do we make an API call to ServiceDesk Plus via a script? If you copy the following code to a script pane in your PowerShell ISE you should be able to run the script with the ‘Play’ button and see the formatted output – note that you’ll have to replace the details of the TECHNICIAN_KEY and RequestID (as shown in red) with values relevant to your own ServiceDesk Plus system (for a reminder see Part 2):

# Powershell HTTP Request

$url =”http://localhost:8888/sdpapi/request/493?TECHNICIAN_KEY=F3DC7E96-56D5-4839-9071-F9A6371241F1&OPERATION_NAME=GET_REQUEST”
$result = (New-Object System.Net.WebClient).DownloadString(“$url”);
write-host $result

 
If everything has gone according to plan you should see your request output in the console panel:

APIPart3_4

Thanks for sticking with it and next time we’ll step through a real example.

Enjoy!






This article is relevant to:
Service Desk

You may be interested in these other recent articles

Get to building your business apps with the new AppCreator

9 June 2022

ManageEngine’s new low-code application development tool Creating an application, building one and deploying it can be expensive and time consuming as you have to make…

Read more

Endpoint Central’s Endpoint Security

31 May 2022

Endpoint Central (formerly Desktop Central) not only got a name change but has also introduced Endpoint Security to help organisations keep their endpoints secured. According…

Read more

Automation in ManageEngine ServiceDesk Plus

20 December 2021

Increasingly customers are looking to automate repetitive and mundane tasks in ServiceDesk Plus. Since the introduction of Deluge, Zoho’s online scripting language, as part of…

Read more

Update on the recent Apache Log4j2 vulnerability – Impact on ManageEngine on-premise and Zoho cloud products

14 December 2021

A high severity vulnerability (CVE-2021-44228) impacting multiple versions of the Apache Log4j2 utility was disclosed publicly on December 9, 2021. The vulnerability impacts Apache Log4j2…

Read more

Who do I contact for technical support for my ManageEngine product?

10 September 2021

When purchasing a ManageEngine product it will either have been supplied on a subscription basis or it would have included an initial Annual Maintenance and…

Read more