• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1374
  • Last Modified:

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.
0
biplabmukh
Asked:
biplabmukh
  • 3
  • 2
  • 2
  • +3
1 Solution
 
Sarang TinguriaSr EngineerCommented:
You may download MBSA as per your OS version
Refer below link

Microsoft Baseline Security Analyzer 2.2 (for IT Professionals)
http://www.microsoft.com/en-in/download/details.aspx?id=7558
0
 
biplabmukhAuthor Commented:
Thanks for your response. This process I already knew it but I am looking for Vbscript to automate the task. any suggestion.
0
 
netballiCommented:
Here is the web site with a few examples for script options with MBSA for generating reports.

http://www.microsoft.com/en-us/download/confirmation.aspx?id=10750
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
0
 
hirenvmajithiyaManager (System Administration)Commented:
User MBSA as all stated above.
0
 
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.
0
 
wasimakCommented:
0
 
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.
0
 
Prashant GirennavarCommented:
Try below code ,

[void][reflection.assembly]::LoadWithPartialName(“Microsoft.UpdateServices.Administration”)
$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.

Regards,

_Prashant_
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

  • 3
  • 2
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now