We are trying to download the Qualys report using the Powershell script. I am having trouble in getting the "report ID", when the report is launched via PS1.
How to get it and auto add it to the fetching list?
You will need to do one operation to fetch the list. For example in my Powershell I would have something like:
CURL --header "myheader" --cookie cookijar --insecure --compressed --data "action=list&state=finished" Qualys URL > outputtofile.xml
Then you can read the XML file into a variable and then I used a a loop like:
foreach ($line in $ResponseData.REPORT_LIST_OUTPUT.RESPONSE.REPORT_LIST.REPORT)
$RRO.reportid = $line.id
$RRO.reporttitle = $line.title.innertext
$RRO.reporttype = $line.type
$RRO.user_login = $line.user_login
$RRO.launch_datetime = $line.launch_datetime
$RRO.outputformat = $line.output_format
$RRO.size = $line.size
$RRO.status = $line.status.state
$RRO.expire = $line.expiration_datetime
The one highlighted above is the ID that you would then use to download the report. Let me know if you still have questions.
Trying with 'Invoke-RestMethod' but getting error while I try to launch the report itself. Don't know whats wrong I am doing here
Report Launch is working when I change as below
Invoke-RestMethod -Headers $hdrs -Uri "$base/report/" -Method Post -Body $reportbody -WebSession $sess
And I am able to get the report id by using the steps from API v2 with Powershell 3.0 Invoke-RestMethod
Retrieving data ...