Quantcast
Channel: THWACK: Popular Discussions - Orion SDK
Viewing all articles
Browse latest Browse all 3719

Unable to do a Node Query by IP Address to get the NodeID

$
0
0

We are trying to conduct a simple query via Powershell in which we query a device by IP address and it returns with the NodeID. We can query by Node ID and it returns with the IP Address, but we are not able to query by the Ip Address and it return the node ID. This works using SWQL Studio using the following query SELECT Nodes.NodeID FROM Orion.Nodes Where IP = '10.0.0.1'  but does not work using a powershell script.

We have in our scripts ;

 

The Script/Statement that Does Not Work

Get-SwisData $swis 'SELECT Nodes\.IP_Address FROM Orion\.Nodes where Nodes.IPAddress='10.0.0.1''

 

This Works

Get-SwisData $swis 'SELECT Nodes\.IP_Address FROM Orion\.Nodes where Nodes.NodeID=55'

10.0.0.1

 

NodeID is System.Int32 and the IP_Address is System.String we are wondering how much of a difference this makes.

 

Error

PS C:\Documents and Settings\Administrator> & 'C:\Powershell Test Scripts\NodeQuery.ps1'

Get-SwisData : no viable alternative at input '.' in Where clause

At C:\Powershell Test Scripts\NodeQuery.ps1:17 char:13

+ Get-SwisData <<<<  $swis 'SELECT Nodes\.IP_Address FROM Orion\.Nodes where Nodes.IPAddress=10.0.0.1'

    + CategoryInfo          : InvalidOperation: (:) [Get-SwisData], FaultException`1

    + FullyQualifiedErrorId : SwisError,SwisPowerShell.GetSwisData

 

Also tried the query like

Get-SwisData $swis 'SELECT Nodes.NodeID FROM Orion.Nodes Where IP = '10.0.0.1''

Get-SwisData : Cannot bind parameter 'Parameters'. Cannot convert the "10.0.0.1" value of

"System.Collections.Hashtable".

At C:\Powershell Test Scripts\NodeQuery.ps1:20 char:13

+ Get-SwisData <<<<  $swis 'SELECT Nodes.NodeID

    + CategoryInfo          : InvalidArgument: (:) [Get-SwisData], ParameterBindingExcepti

    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,SwisPowerShell.GetSwisData

 


Viewing all articles
Browse latest Browse all 3719

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>