Share via


Get SCEP definition list from PowerShell (scrapping)

#BEGIN HERE

cls
$number_of_Definition = 10
$url = "https://www.microsoft.com/security/portal/definitions/whatsnew.aspx"
$webreq = Invoke-WebRequest -Uri $url
$definition_released = ($webreq.AllElements | Where {$_.TagName -eq "Option"}).innerHTML
$date_released = ((($webreq.ParsedHtml.getElementsByTagName(‘div')|Where{ $_.className -eq "span bp0-col-1-1 bp1-col-1-1 bp2-col-1-1 bp3-col-1-1" } ).innerText|
                        Select-String -SimpleMatch("Definition available date"))[1].ToString().trim().split("`r`n"))[2]
$t = $definition_released[0]
Write-Host (10-$number_of_Definition+1)".  Definition Update for Microsoft Endpoint Protection - KB2461484 (Definition "$t")`t"$date_released
$number_of_Definition -= 1
$definition_released = $definition_released[1..($definition_released.Length-1)]
$count = 0
foreach($def in  $definition_released){
    if($number_of_Definition -gt 0){
        $new_url = $url+"?RequestVersion="+$def+"&Release=Released&Package=AM"
        $new_webreq = Invoke-WebRequest -Uri $new_url
        $get_date_released = ((($new_webreq.ParsedHtml.getElementsByTagName(‘div')|Where{ $_.className -eq "span bp0-col-1-1 bp1-col-1-1 bp2-col-1-1 bp3-col-1-1" } ).innerText|
                        Select-String -SimpleMatch("Definition available date"))[1].ToString().trim().split("`r`n"))[2]
        Write-Host (10-$number_of_Definition+1)".  Definition Update for Microsoft Endpoint Protection - KB2461484 (Definition "$def")`t"$get_date_released
        $number_of_Definition-=1
    }
    else{return}
}

#END HERE