PSPHPIPAM icon indicating copy to clipboard operation
PSPHPIPAM copied to clipboard

Id of Folder

Open MartinDoed opened this issue 2 years ago • 2 comments

Hi,

I able to create a folder with: New-PhpIpamSubnet -Params @{ description = "Test"; sectionId = 1; isFolder = 1 }

Now I´m struggling with how I can create a subnet within that folder that I´m just ceated as I´m not able to get the Id of this folder.

When I go back to the GUI and get the Id of that folder from the URL and type 'Get-PhpIPamSubnet -Id xxx' nothing is returned. When using the Id of a subnet the subnet is returned.

In addition Get-PhpIpamAllSubnets does not return any subnets/folders.

Am I´m doing anything wrong here?

Thanks Martin

MartinDoed avatar Sep 29 '22 13:09 MartinDoed

try below code to get all subnets

Invoke-PhpIpamExecute -method get -controller subnets 

# or
Invoke-PhpIpamExecute -method get -controller subnets -identifiers @("all")

yoke88 avatar Sep 29 '22 14:09 yoke88

Thanks for your quick response - it was helpful.

With these lines of code I can get the information I need and procede to create subnets in this newly created folder:

$allFolders= Invoke-PhpIpamExecute -method get -controller folders $folder = $allFolders.data | Where-Object { $_.description -like "Test" } $folderId = $folder.id

MartinDoed avatar Sep 30 '22 11:09 MartinDoed