Reply
Highlighted
Accepted Solution

Get Name from fixedaddress

andrzej
Techie
Posts: 3
1812     0

Hello,

I am working on PS automation for IB. I was able to reserve new IP Address using POST method.

 

$URI = $URIBASE + "fixedaddress"
$data = "{`"ipv4addr`":`"$ips`",`"name`":`"mucaktest1`",`"match_client`":`"RESERVED`",`"comment`":`"aktest1`",`"extattrs`":{`"taskRecord`":{`"value`":`"99999998`"}}}" | ConvertFrom-Json | ConvertTo-Json
$webrequest = Invoke-WebRequest -Uri $URI -Method Post -Body $data -ContentType "application/json" -Credential $cred

I have however difficulties to get IP Adddress for partiicular host name.

I can get IPAddress using following code: 

$URI = $URIBASE + "fixedaddress?ipv4addr=10.10.10.10"
$webrequest = Invoke-WebRequest -Uri $URI -Method Get -Credential $cred

but how to get data for given server name. I tried following and it is not working:

$URI = $URIBASE + "fixedaddress?name=mucaktest"

Any idea how to fix this?

Re: Get Name from fixedaddress

Adviser
Posts: 96
1813     0

As stated in the WAPI Admin Guide

 

name
...
The field is not available for search.

So you could search for IP or get ALL and then search programmatically in your script.

 

Use

 

fixedaddress?_return_fields=name,ipv4addr

to get the name and other fields in return.

Re: Get Name from fixedaddress

Moderator BRampling
Moderator
Posts: 69
1813     0

Are you using DHCP for this new host? The name field is not searchable in a fixedaddress object but it is for a Host record. If you're not using DHCP you could switch to using record:host and gain the ability to search by names.

Showing results for 
Search instead for 
Do you mean 

Recommended for You

Businesses are investing heavily into securing company resources from cyber-attacks form cybercrimin