Created
January 16, 2014 02:06
-
-
Save darkoperator/8448615 to your computer and use it in GitHub Desktop.
PVS Repor Gist
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
{"reply":{"status":"OK", "contents":{"reports":{"report":[{"id":3, "name":"Pcap Vulnerability Scanning Report - Jan 14 2014 07:19:00", "status":"completed", "last_upd | |
ated_time":"2014-01-14 07:19:00", "snapshot_id":0}, {"id":4, "name":"Monitoring Snapshot - Jan 15 2014 20:06:52", "status":"completed", "last_updated_time":"2014-01-1 | |
5 20:06:52", "snapshot_id":1}, {"id":5, "name":"Monitoring Snapshot - Jan 15 2014 20:21:52", "status":"completed", "last_updated_time":"2014-01-15 20:21:52", "snapsho | |
t_id":2}, {"id":6, "name":"Monitoring Snapshot - Jan 15 2014 20:36:52", "status":"completed", "last_updated_time":"2014-01-15 20:36:52", "snapshot_id":3}, {"id":7, "n | |
ame":"Monitoring Snapshot - Jan 15 2014 21:02:23", "status":"completed", "last_updated_time":"2014-01-15 21:02:23", "snapshot_id":4}, {"id":8, "name":"Monitoring Snap | |
shot - Jan 15 2014 21:17:23", "status":"completed", "last_updated_time":"2014-01-15 21:17:23", "snapshot_id":5}, {"id":9, "name":"Monitoring Snapshot - Jan 15 2014 21 | |
:32:23", "status":"completed", "last_updated_time":"2014-01-15 21:32:23", "snapshot_id":6}, {"id":10, "name":"Monitoring Snapshot - Jan 15 2014 21:47:23", "status":"c | |
ompleted", "last_updated_time":"2014-01-15 21:47:23", "snapshot_id":7}, {"id":11, "name":"Monitoring Snapshot - Jan 15 2014 22:02:23", "status":"completed", "last_upd | |
ated_time":"2014-01-15 22:02:23", "snapshot_id":8}]}}}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm running 4.0 on Windows 8.1. It looks like it might be working.
I change the [psobject] to [pscustomobject] too
$r=@"
{"reply":{"status":"OK", "contents":{"reports":{"report":[{"id":3, "name":"Pcap Vulnerability Scanning Report - Jan 14 2014 07:19:00", "status":"completed", "last_updated_time":"2014-01-14 07:19:00", "snapshot_id":0}, {"id":4, "name":"Monitoring Snapshot - Jan 15 2014 20:06:52", "status":"completed", "last_updated_time":"2014-01-15 20:06:52", "snapshot_id":1}, {"id":5, "name":"Monitoring Snapshot - Jan 15 2014 20:21:52", "status":"completed", "last_updated_time":"2014-01-15 20:21:52", "snapshot_id":2}, {"id":6, "name":"Monitoring Snapshot - Jan 15 2014 20:36:52", "status":"completed", "last_updated_time":"2014-01-15 20:36:52", "snapshot_id":3}, {"id":7, "name":"Monitoring Snapshot - Jan 15 2014 21:02:23", "status":"completed", "last_updated_time":"2014-01-15 21:02:23", "snapshot_id":4}, {"id":8, "name":"Monitoring Snapshot - Jan 15 2014 21:17:23", "status":"completed", "last_updated_time":"2014-01-15 21:17:23", "snapshot_id":5}, {"id":9, "name":"Monitoring Snapshot - Jan 15 2014 21:32:23", "status":"completed", "last_updated_time":"2014-01-15 21:32:23", "snapshot_id":6}, {"id":10, "name":"Monitoring Snapshot - Jan 15 2014 21:47:23", "status":"completed", "last_updated_time":"2014-01-15 21:47:23", "snapshot_id":7}, {"id":11, "name":"Monitoring Snapshot - Jan 15 2014 22:02:23", "status":"completed", "last_updated_time":"2014-01-15 22:02:23", "snapshot_id":8}]}}}}
"@ | ConvertFrom-Json
foreach ($report in $r.reply.contents.reports.report)
{
if ($report.name -like "Pcap*")
{
$report_type = "PCAP"
}
else
{
$report_type = "Snapshot"
}
$reportprops = [ordered]@{
Id = $report.id
Name = $report.name
Status = $report.status
LastUpdate = $report.last_updated_time
SnapshotId = $report.snapshot_id
Type = $report_type
}
[pscustomobject]$reportprops
}
Id : 3
Name : Pcap Vulnerability Scanning Report - Jan 14 2014 07:19:00
Status : completed
LastUpdate : 2014-01-14 07:19:00
SnapshotId : 0
Type : PCAP
Id : 4
Name : Monitoring Snapshot - Jan 15 2014 20:06:52
Status : completed
LastUpdate : 2014-01-15 20:06:52
SnapshotId : 1
Type : Snapshot
Id : 5
Name : Monitoring Snapshot - Jan 15 2014 20:21:52
Status : completed
LastUpdate : 2014-01-15 20:21:52
SnapshotId : 2
Type : Snapshot
Id : 6
Name : Monitoring Snapshot - Jan 15 2014 20:36:52
Status : completed
LastUpdate : 2014-01-15 20:36:52
SnapshotId : 3
Type : Snapshot
Id : 7
Name : Monitoring Snapshot - Jan 15 2014 21:02:23
Status : completed
LastUpdate : 2014-01-15 21:02:23
SnapshotId : 4
Type : Snapshot
Id : 8
Name : Monitoring Snapshot - Jan 15 2014 21:17:23
Status : completed
LastUpdate : 2014-01-15 21:17:23
SnapshotId : 5
Type : Snapshot