Hey folks, I'm trying to create a powershell script to perform a simple task but I'm getting errors on the format of the output. I've checked a number of threads on Thwack, and after trying many of the suggestions, I'm still stuck. I'm at that point where I can't tell which way is forward or backwards.
The purpose of the script is to upload a file to Citrix Sharefile. Ultimately I want the script to tell me how long the upload took, but for now I'd be happy just getting a status reports successful completion.
Here's the script:
Add-PSSnapin ShareFile$sfClient = Get-SfClient -Name "C:\Users\mytoken.sfps"$ShareFileHomeFolder = (Send-SfRequest $sfClient -Entity Items).UrlNew-PSDrive -Name sf -PSProvider ShareFile -Client $sfClient -Root "\" -RootUri $ShareFileHomeFolder > $null$timetaken = (Measure-Command {
Copy-SFItem C:\FDT\fdt.jar sf:/Uploader
} ).totalsecondsRemove-PSDrive sf > $null$elapsedtime = ([math]::Round($timetaken))Write-host "Statistic: 0"
Exit 0;The SAM template is set to inherit credentials from the node and use remote execution. I've tried it with both 32-bit and 64-bit execution.
When I test the script against the target node, the file is successfully uploaded -- I can see the file in my Sharefile browser. For some reason, however, the script results aren't being interpreted correctly. I've even resorted to statically setting the statistic value, but that doesn't help either.
The error in the debug log says :
2017-01-30 13:38:40,127 [STP SmartThreadPool Thread #0] [C4277] ERROR SolarWinds.APM.Probes.PowerShellProbe - SolarWinds.APM.Probes.Script.ScriptConfigurationException: Script output values are not defined or improperly defined.
And from the test result details screen:
Output: ==============================================
Statistic: 0
I'm on SAM 6.3.0. Any ideas?
Edit: I should also note that when I edit the script, I'm getting "Output Result: Not Defined" when I click the 'Get Script Output button." I'm sure this is the root of the issue, but I don't know why it won't pickup any results.