Get the XML content for RSS and then reshape the output (Windows Patch)

Source: Internet
Author: User
Tags cdata

$report= [pscustomobject]@{' Date ' =$null; ' MSRC ' =$null; ' KB ' =$null; ' Severity ' =$null; ' Version ' =$null; ' Summary ' =$null; ' Threattype ' =$null}$report| Export-csv-path E:\PatchReport.csv-Force-Encoding Unicode-delimiter"' t"$parttern="[(]\d{7}[)]"  #get the right-most KB number of the title, which is common for any year's patches$parttern _title="\b (Information disclosure| Remote Code execution| Elevation of privilege| Security Feature bypass| Cumulative Security update| Security update| Denial of service| Tampering) \b"$WebClient= new-Object System.Net.WebClient$WebClient. Encoding=[system.text.encoding]::UTF8$xml= [XML] ($WebClient. Downloadstring ("Https://technet.microsoft.com/en-us/security/rss/bulletin"))$xml. Rss.channel.item |foreach {$msrc=$_. link.substring ($_. link.length-8, 8) Do {$patchweb=$WebClient. Downloadstring ("https://technet.microsoft.com/en-us/library/security/$msrc")}  while(!$?)#$? Indicates whether the result returned by the last command executed is true or FALSE, where true$result= [Regex]::match ($patchweb,$parttern)$kbnumbers=$result. value. Substring (1, 7)#KB$cdata=$_. Encoded. InnerText-replace "Severity Rating:","" -replace "Revision Note:","" -replace "Summary:",""-split"<br/>"#Release date +ms number +KB + Hazard level + version + summary information + threat typeforeach($kbnumber inch $kbnumbers) {$_. pubdate.substring (0,10) +"' t"+ ($_. link). substring ($_. link.length-8, 8) +"' t"+$kbnumber+"' t"+$cdata[0] +"' t"+$cdata[1]. Substring (0,4) +"' t"+$cdata[2] +"' t"+ [Regex]::match ($_. title,$parttern _title, ' IgnoreCase ')} } | Out-file-filepath E:\PatchReport.csv-Append-Encoding Unicode

Get the XML content for RSS and then reshape the output (Windows Patch)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.