Hello,
i can add with restful api and powershell host definitions to a sophos utm 9.
See the Script below.
But how can i add an interface and an ipv4 dhcp setting (configured dhcp)?
Many thanks in advance.
Greetings
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.