This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Windows Powershell Script produces Output Results : Not Defined when run from SAM

Hello,

I am attempting to run a Windows Powershell Component Monitor in order to monitor the DFS backlog on one of our file servers.  I am running into an issue with getting this created in SAM 6.7.  When I set the test node and run it against the target server I am seeing a "Down" result.  When I go to the script Body within the monitor and test the script itself for Output, I get a Output Results : Not Defined message.

When I run this same script from the Solarwinds server via Powershell it completes without error.

Attached is the powershell script I am trying to get working.  I have also imported a couple "DFS Backlog" templates from THWACK and am seeing the same output.

DFS Backlogs.ps1
  • In your script, it looks like its getting caught at the exit 1. Exit 1 tells SAM to return down. When it returns as down you lose the ability to see a message or statistic. I've changed the final ELSE statement to below which should help narrow down the issue

    else
    {
      Write-Host "Message: MicrosoftDFS WMI Namespace does not exist on '$computer'. Run locally on a system with the Namespace, or provide computer parameter of that system to run remotely."
      Write-host "Statistic: 3"
      exit 3;
    }

    If it is getting caught here it will return as critical instead of down and should help you narrow down where the logic in your script might be failing if that is not the expected result.

    Also, are you identifying the "$computer" variable? The script you are running is looking for it as the first arguement