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.

Powershell Invoke-sqlcmd not working in Monitor Template Powershell Module

if i run from Powershell command line on server i get results.

if i run from script body i get "not defined"

i've added invoke sqlcmd on all of our Solarwinds Servers.

Parents
  • I format mine a little different but they run. 

    Invoke-Sqlcmd -Query "MyQuery From @Results" -ServerInstance "SQLServerName" -Database "DatabaseName"

  • @bobmarley

    I tried and get the same error. 

    Does the above script you suggested work for you in the Component Monitor?  If so, could you provide a screenshot just to see if anything stands out to me that I'm doing differently?  I've tried so many different combinations and it seems like nothing works with Invoke-sqlcmd in the component monitor even though the commands work in the Powershell application.  I called Solarwind Tech Support and was referred back to Thwack so any assistance would be helpful.  Right now i'm at the stage of "will the invoke-Sqlcmd command work at all, in any query in Component Monitor."

Reply
  • @bobmarley

    I tried and get the same error. 

    Does the above script you suggested work for you in the Component Monitor?  If so, could you provide a screenshot just to see if anything stands out to me that I'm doing differently?  I've tried so many different combinations and it seems like nothing works with Invoke-sqlcmd in the component monitor even though the commands work in the Powershell application.  I called Solarwind Tech Support and was referred back to Thwack so any assistance would be helpful.  Right now i'm at the stage of "will the invoke-Sqlcmd command work at all, in any query in Component Monitor."

Children
No Data