SMLET Get-SCSMObject will yield no result in .Net Script Activity
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:
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
a despairing Orchestrator user