Hello,
I did try sending 'details-level' in my powershell code. I got the same result
I modified the powershell result to result.'used-directly' now I am getting total but still other output aren't visible
My new output. I still couldn't see whether its used in objects or access-control-rules.
I don't know if this is checkpoint issue or power shell issue. If any one familiar with Power shell, can you please check my code and help.
@{total=1; objects=System.Object[]; threat-prevention-rules=System.Object[]; nat-rules=System.Object[]; access-control-rules=System.Obj
ect[]}
======================================
# Ignore SSL cert Exception
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
# Login to Management server and obtain sid
$URL = "https://xx.xx.xx.xx/web_api"
$Action = "/login"
$URLAnon = "$URL$Action"
$headers = @{ "Content-Type" = "application/json"
}
$login = @{
"user" = "admin"
"password" = "yyyyy"
}
$login = $login | ConvertTo-Json
$response = Invoke-RestMethod -Method Post -Headers $headers -Uri $URLAnon -Body $login
$sid = $response.sid
# Where-Used
$Action = "/where-used"
$URLAnon = "$URL$Action"
$headers = @{
"Content-Type" = "application/json"
"X-chkp-sid" = $sid
}
$WhereUsed = @{
"name" = "MY-HOST"
}
$WhereUsed = $WhereUsed | ConvertTo-Json
$result = Invoke-RestMethod -Method Post -Headers $headers -Uri $URLAnon -Body $WhereUsed
Write-Host $result.'used-directly'
======================================