Quantcast
Channel: THWACK: Discussion List - All Communities
Viewing all articles
Browse latest Browse all 16365

Query works in SWQL but not in SWIS

$
0
0

Hey all,

 

I been trying to build a powershell script using Orion SDK that finds all IP addresses that are available between two subnets.

 

When I create the query in SWQL studio it works!

SELECT IPAddress, DnsBackward, DhcpClientName FROM IPAM.IPNode I Where Status=2 AND (I.Subnet.DisplayName = 'SUBNET1' OR I.Subnet.DisplayName = 'SUBNET2')

 

But when I use "get-SwisData" it fails and I get a big array that contains "PscxDynamicType0" over and over. Below is my script and the array I am trying to walk through is "$objSwisData".

 

#Region PSSnapin presence check/add
if (!(Get-PSSnapin -Name "SwisSnapin" -ErrorAction SilentlyContinue))
{       Add-PSSnapin SwisSnapin -ErrorAction SilentlyContinue
}
#EndRegion
$target="Server"
$swis = Connect-Swis -host $target -UserName "username" -Password "password"

$objSwisData = Get-SwisData -SwisConnection $swis -Query "SELECT IPAddress, DnsBackward, DhcpClientName FROM IPAM.IPNode I Where Status=2 AND (I.Subnet.DisplayName = 'SUBNET1' OR I.Subnet.DisplayName = 'SUBNET2' )"

foreach($nodeSwisData in $objSwisData){
  $counter++  Write-host $nodeSwisData.IPAddress  }
}

 

 

Let me know if anyone has run into something similar.


Thanks,

 

Dustin


Viewing all articles
Browse latest Browse all 16365

Trending Articles



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