I'm trying to write a SAM Template for Windows PowerShell Monitor which will leverage a local file for at least some of the data. I'm not getting that to work in Orion. I'm just trying to validate the concept before I spend time writing up something that won't work, so it's just a simple script.
Version 1:
The file on the node which would be executed by the PowerShell Monitor
Write-Host "Message.1: Hello World" Write-Host "Statistic.1: 1"
The PowerShell Monitor:
$ScriptBlock = Get-Content -Path "C:\Users\Public\test.ps1" | Out-String Invoke-Expression -Command $ScriptBlock Exit(0)
I thought that perhaps the Write-Host statements might need to be in the Orion component instead, so I tried:
Version 2:
File on the node:
$Val1 = "Hello World" $Val2 = 1
PowerShell Monitor:
. "C:\Users\Public\test.ps1" # Dot Sourcing the content Write-Host ("Message.1: " + $Val1) Write-Host ("Statistic.1: " + $Val2) Exit(0)
I actually started out with slightly more complex:
Version 3:
Node:
$Message = "Hello World" $Value = 1 Write-Host ("Message.1: " + $Message) Write-Host ("Statistic.1: " + $Value)
Orion:
$ScriptBlock = Get-Content -Path "C:\Users\Public\test.ps1" | Out-String Invoke-Expression -Command $ScriptBlock Exit(0)
I validated that the credential being used by the component has permissions:
Anyone know if this is supported, and if so, what I did wrong?