Wow. OK. I was a bit wrong. After over 2 hours of letting it sit, the session is receiving data.
Let me work on this a bit more.
Wow. OK. I was a bit wrong. After over 2 hours of letting it sit, the session is receiving data.
Let me work on this a bit more.
Hmph.
Almost 2.5 hours I got back 187253 results from this:
$page = 0
do { Invoke-NexposeAssetSearch -SearchQuery @{filters=@(@{field=‘host-name’; operator=‘is-empty’}); match=‘all’; page=‘$page’; size=‘5’} ; $page++ }
until ( $page -gt 0 )
Status on this:
In the ticket I started with support, they suggested I execute the following command, then restart the console and try again:
set custom property com.rapid7.enable.fullAssetDelete=false
I did that, and while that was happening I updated my script a bit, and it seems to be working:
import-module -name Rapid7Nexpose
$cred = get-credential “My ID”
Connect-NexposeAPI -Hostname ‘insightvm.example.com’ -Port 3780 -Credential $cred
$results = Invoke-NexposeAssetSearch -SearchQuery @{filters=@(@{field=‘host-name’; operator=‘is-empty’}); match=‘all’} | select -expand id
write-host “nGathered Ghosts
n” -ForegroundColor Green
$filename = "c:\temp$(get-date -f yyyy-MM-dd-HHmm)GhostIDs.txt"
$results | out-file $filename
write-host “nWrote Ghosts to file
n” -ForegroundColor Green
Connect-NexposeAPI -Hostname ‘gfc-insightvm.csww.lan’ -Port 3780 -Credential $cred
get-content $filename |
foreach {
Try { remove-NexposeAsset -id $ ; start-sleep -seconds 1 }
Catch { write-host “ID not found” -ForegroundColor Red }
}