-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set/Add Asset Group Enhancement and Purge Functionality (#72)
* Add scanners param to set-qualysassetgroups * remove-QualysHosts * Add-QualysAssetGroups change and changelog++ * PSUseSingularNouns * supportshouldprocess
- Loading branch information
1 parent
bc99277
commit 2c46063
Showing
5 changed files
with
64 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<# | ||
.Synopsis | ||
Purges host assets from Qualys by IP | ||
.DESCRIPTION | ||
Purges host assets from Qualys by IP | ||
.PARAMETER IPs | ||
An array of IPs to purge from Qualys | ||
.EXAMPLE | ||
Remove-QualysHosts -IPs ("192.168.1.1", "192.168.0.0") | ||
#> | ||
|
||
function Remove-QualysHosts{ | ||
[CmdletBinding(SupportsShouldProcess)] | ||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '', | ||
Justification = 'This is consistent with the vendors verbiage')] | ||
param ( | ||
[Parameter(Mandatory=$true)] | ||
[String[]]$IPs | ||
) | ||
|
||
process{ | ||
if ($PSCmdlet.ShouldProcess("$($IPs.count) IPs Will be purged from Qualys")){ | ||
$RestSplat = @{ | ||
Method = 'POST' | ||
RelativeURI = 'asset/host/' | ||
Body = @{ | ||
action = 'purge' | ||
ips = ($IPs.Trim() -join ", ") | ||
} | ||
} | ||
$Response = Invoke-QualysRestCall @RestSplat | ||
$Response.BATCH_RETURN.RESPONSE.BATCH_LIST.BATCH | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters