Hi,
I need to monitor a value via a soap request. I want to do this with a powershell script monitor.
Before I get the value, I need to authenticate via this method, found in the documentation of the application:
#Authentication
$Webservice = New-WebServiceProxy -Uri $Wsdl
$Authentication = new-Object -TypeName Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1vice_cc_MessagingToolsAPI_WSDL.authentication
$Authentication.username = ‘??’
$Authentication.password = ‘??’
$Webservice.authenticationValue = $Authentication
When I run my script as a task in scom, I get the right information.
When I do the same in a monitor, I’m getting this error:
Exception setting “authenticationValue”: “Cannot convert the “Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1vice_cc_MessagingToolsAPI_WSDL.authentication” value of type “Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1vice_cc_MessagingToolsAPI_WSDL.authentication” to type “Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy9vice_cc_MessagingToolsAPI_WSDL.authentication”.”
On the internet, I found that this has to do with not ending the session between 2 checks of the monitor. This can be true, because when I run the same via a task, everytime the session will ended when the task is completed.
Has anybody an idea how I can solve this problem?
Kind regards,
Luc