Help us enhance your Sophos Community experience. Share your thoughts in our Sophos Community survey.

This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Sophos UTM 9 Restful API Powershell host definition hinzufügen (kein Problem, aber wie) mit interface und ipv4 dhcp

Hallo,

mit dem unten gelisteten Script kann ich eine Host Definition per Restful API hinzufügen.

Aber gibt es per API noch die Möglichkeit die DHCP Settings zu setzen?

Weiterhin gibt es ja im "Body" das Feld für Interface. Wie muss  ich dort das Interface angeben, damit das funktioniert?
Einfach nur die REF-ID angeben, führte nicht zum Erfolg.

 

Vielen lieben Dank im Voraus!

Beste Grüße

Maik

 

SCRIPT:

$networkURI = 'HOST:4444/.../'

$token = '1122334455'
$tokenBase64 = [Convert]::ToBase64String([System.Text.Encoding]::Default.GetBytes("token:" + $token))

$AllProtocols = [System.Net.SecurityProtocolType]'Tls,Tls11,Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols

$name = "NAME"
$ip = "11.22.33.44"
$comment = "COMMENT"
$macs = '"00:00:00:11:11:11","00:00:00:22:22:22"'

$headers = @{}
$headers.add('Content-Type', 'application/json')
$headers.add('Accept', 'application/json')
$headers.add("Authorization",'Basic ' + $tokenBase64)


$body = '{"address":"' + $ip + '","address6":"","comment":"' + $comment + '","duids":[],"hostnames":[],"interface":"","macs":[' + $macs + '],"name":"' + $name + '","resolved":false,"resolved6":false,"reverse_dns":false}'


Invoke-RestMethod -Uri $networkURI -Method Post -Headers $headers -Body $body



This thread was automatically locked due to age.