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