SMLET Get-SCSMObject will yield no result in .Net Script Activity

Lorenz_BennLorenz_Benn Partner IT Monkey ✭
edited August 13 in Orchestrator

Hello Cireson folks,


I am getting totally mad at this issue:


My goal is it to get a specific type of "Cireson.AssetManagement.HardwareAsset" but only so much objects like I tell the script to do. E.g.: I want only 2 HardwareAssets but I know I have 100 of this type.

In a Powershell Environment (ISE etc.) my script works without any issue, it works from my client, from any SCSM-Server and from the actual runbook server.

But when I try to insert this script into a .Net Script activity it does not give back any results. So tried to narrow down the issue and made a singular .Net Script activity with a few SMLets commands to see if I get back any results, I connected the Script activity to "append line".


If I use for example

Get-SCSMClass -Id "c0c58e7f-7865-55cc-4600-753305b9be64"

and publish the variable containing the result, I get to see the result in my pseudo log-file. In this case:

Cireson.AssetManagement.HardwareAsset


BUT when I try to perform any Get-SCSMObject it does not yield any result. Here is the actual test script

"

$smdefaultcomputer = "SERVERNAME"


Import-module "C:\Program Files\WindowsPowerShell\Modules\SMLets\0.5.0.1\smlets.psd1" -Force


$configItems=Get-SCSMObject -Class (Get-SCSMClass -Name "System.ComputerHardware")

$test = $configItems.Count

"

$test will be published and "Append Line" will write the variable in my pseudo log file.

It is always 0

I tried several classes for Get-SCSMObject but I get no result, I also tried to include -computername in Get-SCSMobject still nothing


Also it is not a user access issue, the user running the runbooks can access everything in SCSM


I would appreciate any help


Greetings

a despairing Orchestrator user

Best Answer

Answers

  • Nicholas_VelichNicholas_Velich Cireson Consultant Ninja IT Monkey ✭✭✭✭

    Hello Lorenz,


    Orchestrator 2012/2016 are only able to run PowerShell v2 out-of-box, and SMLets requires at least v3. The latest version of Orchestrator (2019) supports newer versions of PowerShell.


    Alternatively, you can apply a registry update to allow older versions of PowerShell to run on an older version of Orchestrator. More info can be found in this blog here: https://cireson.com/blog/hitting-limits-and-breaking-through-making-orchestrator-work-for-you/


    Thanks,

    Nick

  • Lorenz_BennLorenz_Benn Partner IT Monkey ✭

    Hey Nocholas,


    I performed

    restarted the Orchestrator, but still Get-SCSMObject does not bring any result.

  • Nicholas_VelichNicholas_Velich Cireson Consultant Ninja IT Monkey ✭✭✭✭

    Do you have any files present at the following location on your Orchestrator server?


    C:\Program Files\Common Files\SMLets

  • Lorenz_BennLorenz_Benn Partner IT Monkey ✭

    Nope no files at this location

Sign In or Register to comment.