Forum Discussion

Kelemvor's avatar
Kelemvor
Icon for Expert rankExpert
2 months ago

How to create a Powershell Datasource? Getting Commands not recognized

Hi,

I don't know how to create my own datasources so I'm trying to figure this out.  I'm running a script on a Hyper-V Host server but get errors that the commands are not found.  The script works fine when I run it directly on the host.  It just doesn't run when I run it from testing within my DataSource.

When LM runs the PowerShell script, does it run it on the end-host computer or does it run it from its own collector?  Maybe I need to install the Hyper-V Module onto the collectors and then have them run the command specifying the hostname in the command?

Thanks.

  • As you saw, the datasource checks will run from the collector. But you can have the datasource script do a psremote to the hyper-v server to run commands that way. But then you might run into powershell serialization weirdness pulling data back. Installing the module on the collector itself would be the easier and usually best.

    • Kelemvor's avatar
      Kelemvor
      Icon for Expert rankExpert

      I installed the module on the collector and got it to work.  Only problem is that if we ever change collectors, I have to remember to do that again.  I'm wondering if I can just do an invoke-command to run the script on the remote host since that's included in PS.  Maybe I'll play with that next week.

      Thanks.

  • OK.  That was the problem.  Had to install the HPV PS Module on the collector and now it runs.