Good afternoon,
I'm trying to execute a Powershell script using a SAM monitor with the follwing script:
$size = Invoke-Sqlcmd -Query "SELECT name AS FILENAME, PercentFull = CASE WHEN max_size = -1 OR max_size = 268435456 THEN '0' WHEN (max_size - size) = 0 THEN '100' WHEN (max_size - size) <> 0 OR max_size <> -1 THEN CAST((size * 8 / 1024) * 100 / ((max_size * 8) / 1024) as int) END FROM master.sys.master_files WHERE state = 0 AND type_desc IN ('ROWS') ORDER BY database_id, file_id" -ServerInstance "${IP}\SQLEXPRESS";
Write-Host 'Statistic: ' $size[0].FileName;
Write-Host 'Statistic: ' $size[0].PercentFull;
If I copy/paste this code in a PowerShell ISE window on my Orion Server, it brings me the results successfully, reading correctly the SQL Server information.
But if I try to test it from Orion, it always shows me this:
Output Result: ND Not Defined
I set the variable '${IP}' on "Script Arguments" and set the login credential as "NONE", as the Orion host is a trusted host on SQL Server.
Any clues?
Thanks!