VBscript to generate the report of Missing patches on servers

Hello Team,

could you please help me out with the VBscript that will generate the report of pending patch information from the servers listed in textpad remotely.
Who is Participating?
Prashant GirennavarConnect With a Mentor Commented:
Try below code ,

$global:wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer(‘wsus ServerName Goes here’,$False,Port Number goes here of your WSUS)
$computerscope = New-Object Microsoft.UpdateServices.Administration.ComputerTargetScope
$updatescope = New-Object Microsoft.UpdateServices.Administration.UpdateScope
$s = Get-Content C:\Names.txt
$a = New-Object Microsoft.UpdateServices.Administration.ComputerTargetScope
$b = New-Object Microsoft.UpdateServices.Administration.UpdateScope
$c =  $wsus.getcomputertargets($a)
$id = @()
Foreach($Server in $s)
 $id += @($c | ? {$_.FulldomainName -like “$Server*”} | Select-Object -ExpandProperty ID)

$k = $wsus.GetSummariesPerComputerTarget($b,$a)
$k | Where-Object{$id -contains $_.ComputerTargetID} | ForEach {New-Object PSobject -Property @{
ComputerTarget = ($wsus.GetComputerTarget([guid]$_.ComputerTargetId)).FullDomainName
DownloadedCount = $_.DownloadedCount
FaliedCount = $_.FailedCount
}} | Export-Csv C:\PatchResult.csv -NoClobber -Force

Open in new window

Note -

$global:wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer(‘wsus ServerName Goes here’,$False,Port Number goes here of your WSUS)

If you are using the default WSUS Port 80 then please no need of putting the WSUS Port number

The code will show the pending/Failed pathes on the list of servers.

List of servers are stoed in C:\Names.txt file.

Let me know if anything else is required.

More on this in my blog - http://prashant1987.wordpress.com/2012/11/21/powershell-script-to-query-wsus-for-downloadedfalied-patches-on-list-of-servers/

Hope this helps.


Sarang TinguriaSr EngineerCommented:
You may download MBSA as per your OS version
Refer below link

Microsoft Baseline Security Analyzer 2.2 (for IT Professionals)
biplabmukhAuthor Commented:
Thanks for your response. This process I already knew it but I am looking for Vbscript to automate the task. any suggestion.
Free tool for managing users' photos in Office 365

Easily upload multiple users’ photos to Office 365. Manage them with an intuitive GUI and use handy built-in cropping and resizing options. Link photos with users based on Azure AD attributes. Free tool!

Here is the web site with a few examples for script options with MBSA for generating reports.

Sarang TinguriaSr EngineerCommented:
Why don't you use widely used solution such as WSUS ..You may control things more efficiently with this and would get a good quality and hassle free reporting system
hirenvmajithiyaManager (System Administration)Commented:
User MBSA as all stated above.
biplabmukhAuthor Commented:
Thanks for your response but using the script in menionted in above link we can pull the pending patch information from local machine any other way we can pull the report of all the servers remotely. Like we can mention all the servers name in text & script can take this as input variable.
biplabmukhAuthor Commented:
Thanks I executed the script & it wokes fine but this script give you the patch information which is installed on the machine. my requirement is to identify the patch which is require to be install (only security patch). can we modify this script to generate the report of pending patch.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.