Forum Discussion
Recovering Quarantined File without Restoring
- zaynhijaziNov 04, 2024Copper Contributor
micheleariis I can download copies of the quarantined files from the portals, but I am trying to see if there is a way to get a copy of the quarantined files programmatically without restoring the quarantined file back on the machine.
- micheleariisNov 04, 2024MCT
$fileId = "FILE_ID_TO_DOWNLOAD" # The ID of the file associated with the alert
$deviceId = "DEVICE_ID_ASSOCIATED"$downloadUrl = "https://api.securitycenter.microsoft.com/api/machines/$deviceId/files/$fileId"
$response = Invoke-RestMethod -Method Post -Uri $downloadUrl -Headers $headers- zaynhijaziNov 04, 2024Copper Contributor
micheleariis Thank you for your response. I'm assuming the "$deviceId" would refer to the "machineId". Regarding the fileId, is that the SHA-1 or the SHA-256 associated with the file? Also do you possibly have a link to somewhere in the Microsoft Defender For Endpoint API, where it has an example of this same HTTP Request that you mentioned. And lastly, for the headers, do I need to have anything other than the bearer token?