Querying ITSM Incident tickets from Powershell

by Grzegorz Kulikowski

I have spent few days now in order to get information about tickets that are stored in ITSM. In order to query for INCident ticket in BMC ITSM we need
the uri to the webservice. How to get it ?
Access your internal ITSM server to get list of webservices:

You will be prompted for user and password. Authenticate. After this you will receive a list of Web service name, service type, description. Copy link to
HPD_IncidentInterface_WS . This one will allow us to query our incident tickets.
Should be something like this:
In order to consume it i use this uri:
Replace the ‘protected’ with ‘public’

Open powershell console and do the following:
$myitsm=New-WebServiceProxy -Uri $uri -Namespace ITSM
Let’s complete authentication:

$auth= New-Object ITSM.AuthenticationInfo
$auth.password= [System.Runtime.InteropServices.marshal]::PtrToStringAuto([System.Runtime.InteropServices.marshal]::SecureStringToBSTR($cred.password))

You can always put it in plain text ($auth.username=’myuser’ // $auth.password=’yourpassword’)
Let’s set a INC number that we will be looking for

Let’s build the search criteria

$criteria=”‘Incident Number’ = “”$tid”””

If you would like to build criteria based on your name and surname then it would look like this:
$criteria=”‘First Name’ = “”Grzegorz”” AND ‘Last Name’ = “”Kulikowski”” ”

Ok, lets perform our search. In my case i know that i will only receive 1 INC ticket.
$answer.count -> that will be 1 now as i have only 1 INC in my queue
the method: HelpDesk_QueryList_Service asks for ( search criteria, starting record number, maximum records returned)
i can now open my INC ticket to see what is inside, sample output:

[sourcecode language=”powershell”]
Assigned_Group : Greg Team
Assigned_Support_Organization : Greg Team Org
Assignee : Grzegorz Kulikowski
City : Monki
Closure_Product_Category_Tier1 : Application
Company : Greg S.A
Country : Polska
Department : IT section
Summary : test123
Notes : test123
First_Name : Grzegorz
Impact : {Item4MinorLocalized}
Incident_Number : INC000000049839
Internet_Email : gregua@internety.com
Last_Name : Kulikowski
Product_Categorization_Tier_1 : Application
Product_Categorization_Tier_2 : Infrastructure Services
Reported_Source : {DirectInput}
Service_Type : {UserServiceRestoration}
Status : {InProgress}
Urgency : {Item4Low}
HPD_CI : Server

I have listed only few from the properties.

So actually, to run your query this portion of code is enough:

[sourcecode language=”powershell”]
$myitsm=New-WebServiceProxy -Uri http://itsm.midtier.lan/arsys/WSDL/public/itsm.midtier.lan/HPD_IncidentInterface_WS -Namespace ITSM
$auth= New-Object ITSM.AuthenticationInfo
$auth.password= [System.Runtime.InteropServices.marshal]::PtrToStringAuto([System.Runtime.InteropServices.marshal]::SecureStringToBSTR($cred.password))
$criteria="’Incident Number’ = ""$tid"""

It does not look scary 😉 Took me some time to figure this out though. In next post i will try to show how to query for Changes and how to update tickets,crqs. Have in mind that i am not ITSM specialist, just end-user of this application. If you have any documents about using itsm web services, please share it in comments.

Useful links:
BMC Remedy IT Service Management 7.0 Integration
Using BMC ITSM OOB Web Service

In case of having issues check this post as well:


You may also like


Enrique Martinez December 2, 2013 - 12:18 pm

Hi Grzegorz. Using your code to connect to ITSM via Powershell I’m not getting any results (the $answer variable remains empty), but using fiddler I’m able to see that both the call and the response from the web service are OK. Do you have any idea why the method isn’t returning any value in powershell? some blogs suggest that it may be something related to namespaces… Also, I’m calling the WS using ssl (https)

Querying itsm change requests from powerhsell | VMware and Powershell January 21, 2014 - 12:57 pm

[…] addition ton querying-itsm-incident-tickets-from-powershell […]

Creating an INC/Incident ticket in BMC ITSM using powershell | VMware and Powershell January 28, 2014 - 9:11 pm

[…] that from previous posts you already know how to consume this webservice from powershell (post1,post2) Let’s start our session […]

Maha June 17, 2014 - 3:39 pm

Works using SOAPUI. Your posting gave me the lead. thanks. If anyone looking for the SOAP params in XML





‘Incident Number’ = “INC000000378790” OR
‘Status’ = “In Progress”

Nitin September 2, 2016 - 1:10 pm


I am working on the same but i am not able to do so. I have tried java code and then got your powershell script. But i am afraid its not working for me.


Leave a Reply

Chinese (Simplified)EnglishFrenchGermanHindiPolishSpanish