1 Reply Latest reply on Jan 19, 2016 1:45 PM by danielsdavidr

    IPAM - Making the subnet you query for a variable

    esteagall

      I am trying to use the information from this post How to use the IPAM API and get "Free IP Address" to build a way to automatically get the next available ip, the gateway, and the subnet mask in a script.  I want this to prompt the user for which subnet they want to use.  I'm also doing this via invoke-command.  Below is an example line from my powershell script:

       

      $AvailableIPs = Invoke-Command -ScriptBlock {Get-SwisData $swis 'SELECT DISTINCT TOP 1 I.DisplayName FROM IPAM.IPNode I WHERE Status=2 AND I.Subnet.DisplayName = ''DEV'''} -Session $session

       

      I want to change DEV to be $subnet but I cannot just drop in $subnet and have it work (the variable does exist on the remote session).

       

      Any help is much appreciated.