Hi,
When i use https://icinga2.amg.local/director/importsource/fetch?id=31
i get a downloaded file like “director-importsource-31_20250109105643.json”
when i do this as a user every thing goes well !!
but i want to automated it with a powershell script ( Invoke-WebRequest) or somthing else , but is goes wrong.
i think the reason because the date is dynamic, how can i resove this ?
the code is
$credential = Get-Credential
$source = ‘https://icinga2/director/importsource/fetch?id=31’
$destination = ‘.\export.json’
Invoke-WebRequest -Uri $source -OutFile $destination -Credential $credential
the result is an html file. not like the json i donwload by hand from the browser.