Windows PowerShell

Change BMC TrueSight Slot Values Using SOAP and PowerShell

BMC TrueSight – An Aerial View!!!

While working on Event Management a requirement popped up “Update TruSight the slot value when orchestrator automates the event(s)”. In short the automation agent should close the alert after auto-healing. I expected a REST endpoint but unfortunately SOAP web service was the only option.

To solve this we have to take five steps approach connect, map the mc_ueid, manipulate, update using SendEvent operation and disconnect. Yes, it’s that easy!

Establish the Connection

$WebService = New-WebServiceProxy -Uri 'http://Server001:9080/imws/services/ImpactManager?wsdl' -Namespace "myBPPMDemo"
$Connect_Request = [myBPPMDemo.Connect]::new()
$Connect_Request.userName = "UserName"
$Connect_Request.password = "Password"
$Connect_Request.imname = "string_ts"
$Connect_Request.bufferType = "BMCII_BUFFER_MODE_NONE"
$WebService.Connect($Connect_Request).connectionId

Map mc_ueid

$Send_Event = [myBPPMDemo.SendEvent]::new()
$Send_Event.connection  = $WS.Connect($Connect_Request).ConnectionId
$Send_Event.messageType = [myBPPMDemo.IMMessageType]::MSG_TYPE_MOD_EVENT
$Send_Event.messageClass = "MC_CELL_UNDEFINED_CLASS"
$Send_Event.timeout = 0

$NameValue1 = [myBPPMDemo.NameValue]::new() 
$Value1 = [myBPPMDemo.value]::new()
$Value1.Item = "mc.String_TS.1a7dc6c9.0"
$NameValue1.name  = "mc_ueid"
$NameValue1.value = $Value1
$NameValue1

Manipulate status

$NameValue2 = [myBPPMDemo.NameValue]::new() 
$Value2 = [myBPPMDemo.value]::new()
$Value2.Item = "CLOSED"
$NameValue2.name  = "status"
$NameValue2.value = $Value2
$NameValue2

Update Using SendEvent

$Send_Event = [myBPPMDemo.SendEvent]::new()
$Send_Event.connection  = $WS.Connect($Connect_Request).ConnectionId
$Send_Event.messageType = [myBPPMDemo.IMMessageType]::MSG_TYPE_MOD_EVENT
$Send_Event.messageClass = "MC_CELL_UNDEFINED_CLASS"
$Send_Event.timeout = 0
$Event = [myBPPMDemo.Event]::new()
$Event.NameValue_element = @($NameValue1, $NameValue2)
$Event.subject= "Automation Update"
$Send_Event.message = $Event
$WS.SendEvent($Send_Event)

Disconnect (Do bulk operation and call disconnect)

$Disconnect = [myBPPMDemo.Disconnect]::new()
$Disconnect.connection = $WS.Connect($Connect_Request).connectionId

Enjoy PowerShell 🙂

Leave a Reply

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