Very simple test query to get a list of nodes that start with a certain string. Here is the code:
Add-PSSnapin SwisSnapIn
$DataPath = '<path>'
$OrnUsr = '<username>'
$OrnSvr = '<srvrname>'
$OrnCredFile = "$DataPath\User$OrnUsr.txt"
$OrnCreds = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $OrnUsr, (Get-Content $OrnCredFile | ConvertTo-SecureString)
$SwisCnctn = Connect-Swis -Hostname $OrnSvr -Credential $OrnCreds
$Query = "SELECT NodeID, Caption from Orion.Nodes WHERE Caption LIKE 'ott-sw-p%'"
$QResults = Get-SwisData $SwisCnctn $Query
Write-Host $QResults
Obviously I replaced some variables with placeholders ("<>").
I can copy "Get-SwisData $SwisCnctn $Query" to the Command window and it returns the expected results:

But when I execute from the Script window I get the following:

I have looked at several samples and I believe I have my script structure correct. So why the difference and what can I do to fix it?
Also wondering why the command result above is not left justified which might be related.
THANKS
Mike