Search
-
Error when executing Get-SCSMClass in SMA Powershell script
Hi, Every now and then I get a weird error when executing a script in SMA that otherwise runs without issues. I'm suspecting an intermittent concurrency issue, but I have no idea how to circumvent it. My script then fails on the instruction $ActivityClass = Get-SCSMClass System.Workitem$ -ComputerName $ComputerName The… -
Re: Error when executing Get-SCSMClass in SMA Powershell script
-
Re: Error when executing Get-SCSMClass in SMA Powershell script
This code seems to get around the problem: $ComputerName = 'myServer'<br>Import-Module SMLets<br>$incidentClass = Get-SCSMClass -Name "system.workitem.incident$" -ComputerName $ComputerName<br>If(-not $incidentClass)<br id="null">{<br> Write-Output "Problem with PS module"<br> Import-Module SMLets<br> $IncidentClass =… -
Re: Error when executing Get-SCSMClass in SMA Powershell script
-
Re: Error when executing Get-SCSMClass in SMA Powershell script
-
Re: Error when executing Get-SCSMClass in SMA Powershell script
Yes, I don't mind installing the console if that will solve the issue. I'll get back to the forum in a couple of days.On the other hand, I'm curious as to know a method for converting a hashtable into a string or more strictly control how this error occurs if that is the cause ? Another question is if a try/catch approach… -
Re: Error when executing Get-SCSMClass in SMA Powershell script
Well, you ruled out the issue that I most commonly encounter in SMA, which is not naming all params. I was hopeful that would do it, since that simple action has fixed many scripts for me (which run perfectly fine without it, outside of SMA). I am glad @Justin_Workman has jumped in here, because this might be beyond what I… -
Re: Error when executing Get-SCSMClass in SMA Powershell script
Just to state the obvious, this is a truly strange error message. I have never run across it in years of using SMLets directly, or via Orchestrator and SMA. * What version of SCSM are you running, and what version of SMLets? Same version of SMA as SCSM? * Do you receive this error if you specify the -Name parameter? (e.g.:… -
Re: Error when executing Get-SCSMClass in SMA Powershell script
To expand on my line of thinking here/per your setup: * SCSM has a template that invokes an SMA runbook * SMA invokes that runbook against SCSM remotely (i.e. you aren't inline scripting) * In the past I've seen SMLets need the SCSM Console installed, because they reference dll's within the SCSM installer directory * If… -
Re: Error when executing Get-SCSMClass in SMA Powershell script
I doubt there is a coding error, because it only fails very occasionally as I can observe in the automation Dashboard. What I'm suspecting is that when multiple scripts are triggered simultaneously, and the Get-SCSMClass is called there is some data that is initialised on the management server which is not properly…