I'm trying to figure our why this code that once worked is now failing for me. Did I accidentally change something? When running, the error is "Get-SwisData : Cannot resolve property Hostname". (The PatchWeek and EMSSGuid values are my custom properties.) The weird thing is, there is no error at all when initiating the Swis connection.
# Splat all the SwisConnection parameters and then connect with $swis
$SwisParams = @{
Hostname = 'SERVERFQDN';
Username = 'USERNAME';
Password = 'PASSWORD';
}
$swis = Connect-Swis @SwisParams
# Get all Windows nodes from Orion with their hostname, entity URI, PatchWeek, and EMSSGuid value.
$query = @"
SELECT n.Caption AS [Name], n.Uri AS [EntityUri], ncp.PatchWeek AS [PatchWeek], ncp.EMSSGuid AS [Guid]
FROM Orion.Nodes n
JOIN Orion.NodesCustomProperties ncp ON n.NodeID = ncp.NodeID
WHERE n.Vendor LIKE 'Windows'
ORDER BY Hostname ASC
$OrionNodes = Get-SwisData -SwisConnection $Swis -Query $query
Get-SwisData : Cannot resolve property Hostname
At script.ps1:59 char:15
+ $OrionNodes = Get-SwisData -SwisConnection $Swis -Query $query
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-SwisData], FaultException`1
+ FullyQualifiedErrorId : SwisError,SwisPowerShell.GetSwisData