SlideShare a Scribd company logo
WSUS Sample Scripts These scripts were originally developed for WSUS 3.0, and have been lingering around my script quiver for years. They ’re yours to use, but are offered with no warranties, express or implied Use at your own risk! Because, well, I have to say that…  
This slide deck was used in one of our many conference presentations. We hope you enjoy it, and invite you to use it within your own organization however you like. For more information on our company, including information on private classes and upcoming conference appearances, please visit our Web site,  www.ConcentratedTech.com .  For links to newly-posted decks, follow us on Twitter: @concentrateddon or @concentratdgreg This work is copyright ©Concentrated Technology, LLC
So, why scripting? There ’s a lot you can do with WSUS and the GUI console, but sometimes you have very specific needs. The WSUS GUI is slow Exporting compliance data isn ’t often user-friendly Some items not available or easy in the GUI No On-Demand patching engine! Scripting is just so darn fun…
What Can I Script? Although the WSUS server itself is mostly managed .NET code… … there are 11 COM objects on the client that can be interfaced with VBScript More, if you know COM and VB All are documented in the WSUS SDK. However, for those inexperienced in COM (like me), the WSUS SDK is cryptic at best. (Thank you Don Jones for your help with translation!) There is no central repository of script recipes to steal!
What Can I Script? All scriptable interfaces can be found on MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wua_sdk/wua/interfaces.asp The ones we can script in VBScript are: Microsoft.Update.AgentInfo Microsoft.Update.AutoUpdate Microsoft.Update.Downloader Microsoft.Update.Installer Microsoft.Update.Searcher Microsoft.Update.ServiceManager Microsoft.Update.Session Microsoft.Update.StringColl Microsoft.Update.SystemInfo Microsoft.Update.UpdateColl Microsoft.Update.WebProxy
Remote WUA Client Install This script takes as input a text file with computer names, one per line. This script has no output. When run, the WUA client is installed with the  /force  switch to force the installation Additionally, BITS 2.0 and WinHTTP 5.1 are installed. These are prerequisites for the next scripts to work properly.
Wsus sample scripts
Enumerate Installed Patches This script takes as input a text file with computer names, one per line. This script outputs a .CSV file showing each computer and the installed patches on that computer. Useful for auditing and compliance verification. Easy to generate.
Wsus sample scripts
Enumerate Patches Not Installed This script takes as input a text file with computer names – one per line. This script outputs a .CSV file showing each computer and the patches not installed on that computer. If the computer is connected to a WSUS server, it will show those patches where the Action is set to Install. If the computer is not connected to a WSUS server, it will verify its patch status against WU. … where all patches have  Action =  “Install” Also easier than GUI tool. Slow.
Wsus sample scripts
Multi-Machine On-Demand Patching (You Patch Now!) This script takes as input a text file with computer names, one per line. This script outputs a .CSV file showing each patch installed on that computer. The  Microsoft.Update.UpdateColl  object cannot be remotely created on the client. Thus, the download and install methods won ’t work. So, to fix this, the  WSUS-install.vbs  script actually launches the  WSUS-install-agent.vbs  script on each remote computer. Using PSExec!  Man, I love PSExec! You can either run  WSUS-install-agent.vbs  directly on a machine or use  WSUS-install.vbs  to push it to a list of machines.
Wsus sample scripts
Wsus sample scripts
Match q-Numbers to MS0x-0xx Numbers This script takes no input (but you ’ll need to point it to your WSUS server) This script outputs a .CSV file showing each Security update and the mapping between the knowledgebase article number (the q number) and the Microsoft advisory number (the MS number)
Wsus sample scripts
This slide deck was used in one of our many conference presentations. We hope you enjoy it, and invite you to use it within your own organization however you like. For more information on our company, including information on private classes and upcoming conference appearances, please visit our Web site,  www.ConcentratedTech.com .  For links to newly-posted decks, follow us on Twitter: @concentrateddon or @concentratdgreg This work is copyright ©Concentrated Technology, LLC
Ad

More Related Content

What's hot (20)

Server Core2
Server Core2Server Core2
Server Core2
Concentrated Technology
 
Securely connecting to apps over the internet using rds
Securely connecting to apps over the internet using rdsSecurely connecting to apps over the internet using rds
Securely connecting to apps over the internet using rds
Concentrated Technology
 
WSUS Deployment on Windows Server 2008
WSUS Deployment on Windows Server 2008WSUS Deployment on Windows Server 2008
WSUS Deployment on Windows Server 2008
SolarWinds
 
PowerShell crashcourse for sharepoint
PowerShell crashcourse for sharepointPowerShell crashcourse for sharepoint
PowerShell crashcourse for sharepoint
Concentrated Technology
 
Common WSUS Errors Codes - Decoded and Resolved
Common WSUS Errors Codes - Decoded and Resolved Common WSUS Errors Codes - Decoded and Resolved
Common WSUS Errors Codes - Decoded and Resolved
SolarWinds
 
Optimizing windows 8 for virtual desktops - teched 2013 Jeff Stokes
Optimizing windows 8 for virtual desktops - teched 2013 Jeff StokesOptimizing windows 8 for virtual desktops - teched 2013 Jeff Stokes
Optimizing windows 8 for virtual desktops - teched 2013 Jeff Stokes
Jeff Stokes
 
Wsus config[ver1.0]
Wsus config[ver1.0]Wsus config[ver1.0]
Wsus config[ver1.0]
laonap166
 
Windows 7 Deployment Enhancements
Windows 7 Deployment EnhancementsWindows 7 Deployment Enhancements
Windows 7 Deployment Enhancements
Microsoft TechNet
 
Windows 7 client performance talk - Jeff Stokes
Windows 7 client performance talk - Jeff StokesWindows 7 client performance talk - Jeff Stokes
Windows 7 client performance talk - Jeff Stokes
Jeff Stokes
 
Windows Deployment Tools And Methodologies
Windows Deployment Tools And MethodologiesWindows Deployment Tools And Methodologies
Windows Deployment Tools And Methodologies
Aidan Finn
 
Ws08 R2 Itpro Session 4 Virtualization Technologies
Ws08 R2 Itpro Session 4 Virtualization TechnologiesWs08 R2 Itpro Session 4 Virtualization Technologies
Ws08 R2 Itpro Session 4 Virtualization Technologies
chenley
 
Vmware tools-installation-configuration
Vmware tools-installation-configurationVmware tools-installation-configuration
Vmware tools-installation-configuration
Ram Prasad Ohnu
 
Ewug.dk windows 10 deployment
Ewug.dk  windows 10 deploymentEwug.dk  windows 10 deployment
Ewug.dk windows 10 deployment
Per Larsen
 
100 most vmware q&a
100 most vmware q&a100 most vmware q&a
100 most vmware q&a
Venkata Ramana
 
Vmware view overview
Vmware view overviewVmware view overview
Vmware view overview
Manny Singh
 
ZCM Software Packaging and ZENworks Application Virtualization
ZCM Software Packaging and ZENworks Application VirtualizationZCM Software Packaging and ZENworks Application Virtualization
ZCM Software Packaging and ZENworks Application Virtualization
Roel van Bueren
 
Vmware inter
Vmware interVmware inter
Vmware inter
Venkata Ramana
 
Vmware thin app architecture
Vmware thin app architectureVmware thin app architecture
Vmware thin app architecture
solarisyougood
 
Admincenter
AdmincenterAdmincenter
Admincenter
Rajiv Pandey
 
Inside Windows 8 – Mastering Windows Deployment Services and MDT 2012 Update 1
Inside Windows 8 – Mastering Windows Deployment Services and MDT 2012 Update 1 Inside Windows 8 – Mastering Windows Deployment Services and MDT 2012 Update 1
Inside Windows 8 – Mastering Windows Deployment Services and MDT 2012 Update 1
Microsoft TechNet - Belgium and Luxembourg
 
Securely connecting to apps over the internet using rds
Securely connecting to apps over the internet using rdsSecurely connecting to apps over the internet using rds
Securely connecting to apps over the internet using rds
Concentrated Technology
 
WSUS Deployment on Windows Server 2008
WSUS Deployment on Windows Server 2008WSUS Deployment on Windows Server 2008
WSUS Deployment on Windows Server 2008
SolarWinds
 
Common WSUS Errors Codes - Decoded and Resolved
Common WSUS Errors Codes - Decoded and Resolved Common WSUS Errors Codes - Decoded and Resolved
Common WSUS Errors Codes - Decoded and Resolved
SolarWinds
 
Optimizing windows 8 for virtual desktops - teched 2013 Jeff Stokes
Optimizing windows 8 for virtual desktops - teched 2013 Jeff StokesOptimizing windows 8 for virtual desktops - teched 2013 Jeff Stokes
Optimizing windows 8 for virtual desktops - teched 2013 Jeff Stokes
Jeff Stokes
 
Wsus config[ver1.0]
Wsus config[ver1.0]Wsus config[ver1.0]
Wsus config[ver1.0]
laonap166
 
Windows 7 Deployment Enhancements
Windows 7 Deployment EnhancementsWindows 7 Deployment Enhancements
Windows 7 Deployment Enhancements
Microsoft TechNet
 
Windows 7 client performance talk - Jeff Stokes
Windows 7 client performance talk - Jeff StokesWindows 7 client performance talk - Jeff Stokes
Windows 7 client performance talk - Jeff Stokes
Jeff Stokes
 
Windows Deployment Tools And Methodologies
Windows Deployment Tools And MethodologiesWindows Deployment Tools And Methodologies
Windows Deployment Tools And Methodologies
Aidan Finn
 
Ws08 R2 Itpro Session 4 Virtualization Technologies
Ws08 R2 Itpro Session 4 Virtualization TechnologiesWs08 R2 Itpro Session 4 Virtualization Technologies
Ws08 R2 Itpro Session 4 Virtualization Technologies
chenley
 
Vmware tools-installation-configuration
Vmware tools-installation-configurationVmware tools-installation-configuration
Vmware tools-installation-configuration
Ram Prasad Ohnu
 
Ewug.dk windows 10 deployment
Ewug.dk  windows 10 deploymentEwug.dk  windows 10 deployment
Ewug.dk windows 10 deployment
Per Larsen
 
Vmware view overview
Vmware view overviewVmware view overview
Vmware view overview
Manny Singh
 
ZCM Software Packaging and ZENworks Application Virtualization
ZCM Software Packaging and ZENworks Application VirtualizationZCM Software Packaging and ZENworks Application Virtualization
ZCM Software Packaging and ZENworks Application Virtualization
Roel van Bueren
 
Vmware thin app architecture
Vmware thin app architectureVmware thin app architecture
Vmware thin app architecture
solarisyougood
 
Inside Windows 8 – Mastering Windows Deployment Services and MDT 2012 Update 1
Inside Windows 8 – Mastering Windows Deployment Services and MDT 2012 Update 1 Inside Windows 8 – Mastering Windows Deployment Services and MDT 2012 Update 1
Inside Windows 8 – Mastering Windows Deployment Services and MDT 2012 Update 1
Microsoft TechNet - Belgium and Luxembourg
 

Viewers also liked (20)

How-To: WSUS Reporting Made Easier
How-To: WSUS Reporting Made EasierHow-To: WSUS Reporting Made Easier
How-To: WSUS Reporting Made Easier
SolarWinds
 
PowerShell custom properties
PowerShell custom propertiesPowerShell custom properties
PowerShell custom properties
Concentrated Technology
 
PowerShell crashcourse
PowerShell crashcoursePowerShell crashcourse
PowerShell crashcourse
Concentrated Technology
 
PowerShell 8tips
PowerShell 8tipsPowerShell 8tips
PowerShell 8tips
Concentrated Technology
 
Examen 70-410
Examen 70-410Examen 70-410
Examen 70-410
victorcorreas
 
Redes locais
Redes locaisRedes locais
Redes locais
Alvaro Gomes
 
WSUS
WSUSWSUS
WSUS
Melany Calle
 
Manual de Instalacion y Configuracion de WSUS
Manual de Instalacion y Configuracion de WSUSManual de Instalacion y Configuracion de WSUS
Manual de Instalacion y Configuracion de WSUS
K-milo Rivera
 
Certificate - Windows Server 2012 R2 Storage Jump Start New Choices
Certificate - Windows Server 2012 R2 Storage Jump Start New ChoicesCertificate - Windows Server 2012 R2 Storage Jump Start New Choices
Certificate - Windows Server 2012 R2 Storage Jump Start New Choices
Asef Liria
 
Microsoft System Center Day 2011
Microsoft System Center Day 2011Microsoft System Center Day 2011
Microsoft System Center Day 2011
netlogix
 
Roadshow: Windows Server 2016 «vNext»
Roadshow: Windows Server 2016 «vNext»Roadshow: Windows Server 2016 «vNext»
Roadshow: Windows Server 2016 «vNext»
Digicomp Academy AG
 
Der flexible Arbeitsplatz von Microsoft - Windows 8
Der flexible Arbeitsplatz von Microsoft - Windows 8Der flexible Arbeitsplatz von Microsoft - Windows 8
Der flexible Arbeitsplatz von Microsoft - Windows 8
ProTechnology GmbH
 
Big Data DIY
Big Data DIYBig Data DIY
Big Data DIY
Olivia Klose
 
Migration of a large IT-Infrastruktur
Migration of a large IT-InfrastrukturMigration of a large IT-Infrastruktur
Migration of a large IT-Infrastruktur
Andreas Lezgus
 
Modernes Rechenzentrum
Modernes Rechenzentrum Modernes Rechenzentrum
Modernes Rechenzentrum
Microsoft Österreich
 
Infrastructure Solution Day | Private
Infrastructure Solution Day | PrivateInfrastructure Solution Day | Private
Infrastructure Solution Day | Private
Microsoft Österreich
 
Data Governance in Apache Falcon - Hadoop Summit Brussels 2015
Data Governance in Apache Falcon - Hadoop Summit Brussels 2015 Data Governance in Apache Falcon - Hadoop Summit Brussels 2015
Data Governance in Apache Falcon - Hadoop Summit Brussels 2015
Seetharam Venkatesh
 
Infrastructure Solution Day | Final
Infrastructure Solution Day | FinalInfrastructure Solution Day | Final
Infrastructure Solution Day | Final
Microsoft Österreich
 
Microsoft Lizenzierung – Server
Microsoft Lizenzierung – ServerMicrosoft Lizenzierung – Server
Microsoft Lizenzierung – Server
Microsoft Österreich
 
Modernes Rechenzentrum - Future Decoded
Modernes Rechenzentrum - Future DecodedModernes Rechenzentrum - Future Decoded
Modernes Rechenzentrum - Future Decoded
Microsoft Österreich
 
How-To: WSUS Reporting Made Easier
How-To: WSUS Reporting Made EasierHow-To: WSUS Reporting Made Easier
How-To: WSUS Reporting Made Easier
SolarWinds
 
Manual de Instalacion y Configuracion de WSUS
Manual de Instalacion y Configuracion de WSUSManual de Instalacion y Configuracion de WSUS
Manual de Instalacion y Configuracion de WSUS
K-milo Rivera
 
Certificate - Windows Server 2012 R2 Storage Jump Start New Choices
Certificate - Windows Server 2012 R2 Storage Jump Start New ChoicesCertificate - Windows Server 2012 R2 Storage Jump Start New Choices
Certificate - Windows Server 2012 R2 Storage Jump Start New Choices
Asef Liria
 
Microsoft System Center Day 2011
Microsoft System Center Day 2011Microsoft System Center Day 2011
Microsoft System Center Day 2011
netlogix
 
Roadshow: Windows Server 2016 «vNext»
Roadshow: Windows Server 2016 «vNext»Roadshow: Windows Server 2016 «vNext»
Roadshow: Windows Server 2016 «vNext»
Digicomp Academy AG
 
Der flexible Arbeitsplatz von Microsoft - Windows 8
Der flexible Arbeitsplatz von Microsoft - Windows 8Der flexible Arbeitsplatz von Microsoft - Windows 8
Der flexible Arbeitsplatz von Microsoft - Windows 8
ProTechnology GmbH
 
Migration of a large IT-Infrastruktur
Migration of a large IT-InfrastrukturMigration of a large IT-Infrastruktur
Migration of a large IT-Infrastruktur
Andreas Lezgus
 
Infrastructure Solution Day | Private
Infrastructure Solution Day | PrivateInfrastructure Solution Day | Private
Infrastructure Solution Day | Private
Microsoft Österreich
 
Data Governance in Apache Falcon - Hadoop Summit Brussels 2015
Data Governance in Apache Falcon - Hadoop Summit Brussels 2015 Data Governance in Apache Falcon - Hadoop Summit Brussels 2015
Data Governance in Apache Falcon - Hadoop Summit Brussels 2015
Seetharam Venkatesh
 
Modernes Rechenzentrum - Future Decoded
Modernes Rechenzentrum - Future DecodedModernes Rechenzentrum - Future Decoded
Modernes Rechenzentrum - Future Decoded
Microsoft Österreich
 
Ad

Similar to Wsus sample scripts (20)

Windows Azure(Pr-1).ppt.pptx
Windows Azure(Pr-1).ppt.pptxWindows Azure(Pr-1).ppt.pptx
Windows Azure(Pr-1).ppt.pptx
PrincePatel272012
 
Deploy applications with TFS Build
Deploy applications with TFS BuildDeploy applications with TFS Build
Deploy applications with TFS Build
Gian Maria Ricci
 
Just another Wordpress weblog, but more cloudy
Just another Wordpress weblog, but more cloudyJust another Wordpress weblog, but more cloudy
Just another Wordpress weblog, but more cloudy
Maarten Balliauw
 
Manual Sophos
Manual SophosManual Sophos
Manual Sophos
Olavo Dalcorso
 
WinOps meetup April 2016 DevOps lessons from Microsoft \\Build\
WinOps meetup April 2016   DevOps lessons from Microsoft \\Build\WinOps meetup April 2016   DevOps lessons from Microsoft \\Build\
WinOps meetup April 2016 DevOps lessons from Microsoft \\Build\
DevOpsGroup
 
What is ASP.NET and Why do we need it?
What is ASP.NET and Why do we need it?What is ASP.NET and Why do we need it?
What is ASP.NET and Why do we need it?
Natural Group
 
Dairy management system project report..pdf
Dairy management system project report..pdfDairy management system project report..pdf
Dairy management system project report..pdf
Kamal Acharya
 
Introducing Windows Azure
Introducing Windows AzureIntroducing Windows Azure
Introducing Windows Azure
Ismail Muhammad
 
App V
App VApp V
App V
rsquaredg
 
Microsoft Virtualization View
Microsoft Virtualization View Microsoft Virtualization View
Microsoft Virtualization View
sanjoysanyal
 
Free tools for win server administration
Free tools for win server administrationFree tools for win server administration
Free tools for win server administration
Concentrated Technology
 
VS Code and Modern Development Environment Preview
VS Code and Modern Development Environment PreviewVS Code and Modern Development Environment Preview
VS Code and Modern Development Environment Preview
Roberto Stefanetti
 
Develop & Deploy Node.js app on Windows Azure
Develop & Deploy Node.js app on Windows AzureDevelop & Deploy Node.js app on Windows Azure
Develop & Deploy Node.js app on Windows Azure
Andri Yadi
 
Web tech
Web techWeb tech
Web tech
SangeethaSasi1
 
Web tech
Web techWeb tech
Web tech
SangeethaSasi1
 
Web techh
Web techhWeb techh
Web techh
SangeethaSasi1
 
Web tech
Web techWeb tech
Web tech
SangeethaSasi1
 
.NET Conf 2019 高雄場 - .NET Core 3.0
.NET Conf 2019 高雄場 - .NET Core 3.0.NET Conf 2019 高雄場 - .NET Core 3.0
.NET Conf 2019 高雄場 - .NET Core 3.0
Jeff Chu
 
Scaling capacity while saving cash
Scaling capacity while saving cashScaling capacity while saving cash
Scaling capacity while saving cash
Kim Moir
 
Aspnet2.0 Introduction
Aspnet2.0 IntroductionAspnet2.0 Introduction
Aspnet2.0 Introduction
ChanHan Hy
 
Windows Azure(Pr-1).ppt.pptx
Windows Azure(Pr-1).ppt.pptxWindows Azure(Pr-1).ppt.pptx
Windows Azure(Pr-1).ppt.pptx
PrincePatel272012
 
Deploy applications with TFS Build
Deploy applications with TFS BuildDeploy applications with TFS Build
Deploy applications with TFS Build
Gian Maria Ricci
 
Just another Wordpress weblog, but more cloudy
Just another Wordpress weblog, but more cloudyJust another Wordpress weblog, but more cloudy
Just another Wordpress weblog, but more cloudy
Maarten Balliauw
 
WinOps meetup April 2016 DevOps lessons from Microsoft \\Build\
WinOps meetup April 2016   DevOps lessons from Microsoft \\Build\WinOps meetup April 2016   DevOps lessons from Microsoft \\Build\
WinOps meetup April 2016 DevOps lessons from Microsoft \\Build\
DevOpsGroup
 
What is ASP.NET and Why do we need it?
What is ASP.NET and Why do we need it?What is ASP.NET and Why do we need it?
What is ASP.NET and Why do we need it?
Natural Group
 
Dairy management system project report..pdf
Dairy management system project report..pdfDairy management system project report..pdf
Dairy management system project report..pdf
Kamal Acharya
 
Introducing Windows Azure
Introducing Windows AzureIntroducing Windows Azure
Introducing Windows Azure
Ismail Muhammad
 
Microsoft Virtualization View
Microsoft Virtualization View Microsoft Virtualization View
Microsoft Virtualization View
sanjoysanyal
 
Free tools for win server administration
Free tools for win server administrationFree tools for win server administration
Free tools for win server administration
Concentrated Technology
 
VS Code and Modern Development Environment Preview
VS Code and Modern Development Environment PreviewVS Code and Modern Development Environment Preview
VS Code and Modern Development Environment Preview
Roberto Stefanetti
 
Develop & Deploy Node.js app on Windows Azure
Develop & Deploy Node.js app on Windows AzureDevelop & Deploy Node.js app on Windows Azure
Develop & Deploy Node.js app on Windows Azure
Andri Yadi
 
.NET Conf 2019 高雄場 - .NET Core 3.0
.NET Conf 2019 高雄場 - .NET Core 3.0.NET Conf 2019 高雄場 - .NET Core 3.0
.NET Conf 2019 高雄場 - .NET Core 3.0
Jeff Chu
 
Scaling capacity while saving cash
Scaling capacity while saving cashScaling capacity while saving cash
Scaling capacity while saving cash
Kim Moir
 
Aspnet2.0 Introduction
Aspnet2.0 IntroductionAspnet2.0 Introduction
Aspnet2.0 Introduction
ChanHan Hy
 
Ad

More from Concentrated Technology (16)

From VB Script to PowerShell
From VB Script to PowerShellFrom VB Script to PowerShell
From VB Script to PowerShell
Concentrated Technology
 
Supporting SQLserver
Supporting SQLserverSupporting SQLserver
Supporting SQLserver
Concentrated Technology
 
PS scripting and modularization
PS scripting and modularizationPS scripting and modularization
PS scripting and modularization
Concentrated Technology
 
PS error handling and debugging
PS error handling and debuggingPS error handling and debugging
PS error handling and debugging
Concentrated Technology
 
PowerShell crashcourse for Sharepoint admins
PowerShell crashcourse for Sharepoint adminsPowerShell crashcourse for Sharepoint admins
PowerShell crashcourse for Sharepoint admins
Concentrated Technology
 
PowerShell crash course
PowerShell crash coursePowerShell crash course
PowerShell crash course
Concentrated Technology
 
PowerShell and WMI
PowerShell and WMIPowerShell and WMI
PowerShell and WMI
Concentrated Technology
 
No-script PowerShell v2
No-script PowerShell v2No-script PowerShell v2
No-script PowerShell v2
Concentrated Technology
 
Managing SQLserver
Managing SQLserverManaging SQLserver
Managing SQLserver
Concentrated Technology
 
Managing SQLserver for the reluctant DBA
Managing SQLserver for the reluctant DBAManaging SQLserver for the reluctant DBA
Managing SQLserver for the reluctant DBA
Concentrated Technology
 
Managing enterprise with PowerShell remoting
Managing enterprise with PowerShell remotingManaging enterprise with PowerShell remoting
Managing enterprise with PowerShell remoting
Concentrated Technology
 
Inventory your network and clients with PowerShell
Inventory your network and clients with PowerShellInventory your network and clients with PowerShell
Inventory your network and clients with PowerShell
Concentrated Technology
 
Implementing dr w. hyper v clustering
Implementing dr w. hyper v clusteringImplementing dr w. hyper v clustering
Implementing dr w. hyper v clustering
Concentrated Technology
 
Iis implementation
Iis implementationIis implementation
Iis implementation
Concentrated Technology
 
Hyper v r2 deep dive
Hyper v r2 deep diveHyper v r2 deep dive
Hyper v r2 deep dive
Concentrated Technology
 
How to configure esx to pass an audit
How to configure esx to pass an auditHow to configure esx to pass an audit
How to configure esx to pass an audit
Concentrated Technology
 

Recently uploaded (20)

Hands On: Create a Lightning Aura Component with force:RecordData
Hands On: Create a Lightning Aura Component with force:RecordDataHands On: Create a Lightning Aura Component with force:RecordData
Hands On: Create a Lightning Aura Component with force:RecordData
Lynda Kane
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Buckeye Dreamin' 2023: De-fogging Debug Logs
Buckeye Dreamin' 2023: De-fogging Debug LogsBuckeye Dreamin' 2023: De-fogging Debug Logs
Buckeye Dreamin' 2023: De-fogging Debug Logs
Lynda Kane
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Buckeye Dreamin 2024: Assessing and Resolving Technical Debt
Buckeye Dreamin 2024: Assessing and Resolving Technical DebtBuckeye Dreamin 2024: Assessing and Resolving Technical Debt
Buckeye Dreamin 2024: Assessing and Resolving Technical Debt
Lynda Kane
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.
gregtap1
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Automation Dreamin' 2022: Sharing Some Gratitude with Your Users
Automation Dreamin' 2022: Sharing Some Gratitude with Your UsersAutomation Dreamin' 2022: Sharing Some Gratitude with Your Users
Automation Dreamin' 2022: Sharing Some Gratitude with Your Users
Lynda Kane
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Salesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docxSalesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docx
José Enrique López Rivera
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
Lynda Kane
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Hands On: Create a Lightning Aura Component with force:RecordData
Hands On: Create a Lightning Aura Component with force:RecordDataHands On: Create a Lightning Aura Component with force:RecordData
Hands On: Create a Lightning Aura Component with force:RecordData
Lynda Kane
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Buckeye Dreamin' 2023: De-fogging Debug Logs
Buckeye Dreamin' 2023: De-fogging Debug LogsBuckeye Dreamin' 2023: De-fogging Debug Logs
Buckeye Dreamin' 2023: De-fogging Debug Logs
Lynda Kane
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Buckeye Dreamin 2024: Assessing and Resolving Technical Debt
Buckeye Dreamin 2024: Assessing and Resolving Technical DebtBuckeye Dreamin 2024: Assessing and Resolving Technical Debt
Buckeye Dreamin 2024: Assessing and Resolving Technical Debt
Lynda Kane
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.
gregtap1
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Automation Dreamin' 2022: Sharing Some Gratitude with Your Users
Automation Dreamin' 2022: Sharing Some Gratitude with Your UsersAutomation Dreamin' 2022: Sharing Some Gratitude with Your Users
Automation Dreamin' 2022: Sharing Some Gratitude with Your Users
Lynda Kane
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Salesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docxSalesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docx
José Enrique López Rivera
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
Lynda Kane
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 

Wsus sample scripts

  • 1. WSUS Sample Scripts These scripts were originally developed for WSUS 3.0, and have been lingering around my script quiver for years. They ’re yours to use, but are offered with no warranties, express or implied Use at your own risk! Because, well, I have to say that… 
  • 2. This slide deck was used in one of our many conference presentations. We hope you enjoy it, and invite you to use it within your own organization however you like. For more information on our company, including information on private classes and upcoming conference appearances, please visit our Web site, www.ConcentratedTech.com . For links to newly-posted decks, follow us on Twitter: @concentrateddon or @concentratdgreg This work is copyright ©Concentrated Technology, LLC
  • 3. So, why scripting? There ’s a lot you can do with WSUS and the GUI console, but sometimes you have very specific needs. The WSUS GUI is slow Exporting compliance data isn ’t often user-friendly Some items not available or easy in the GUI No On-Demand patching engine! Scripting is just so darn fun…
  • 4. What Can I Script? Although the WSUS server itself is mostly managed .NET code… … there are 11 COM objects on the client that can be interfaced with VBScript More, if you know COM and VB All are documented in the WSUS SDK. However, for those inexperienced in COM (like me), the WSUS SDK is cryptic at best. (Thank you Don Jones for your help with translation!) There is no central repository of script recipes to steal!
  • 5. What Can I Script? All scriptable interfaces can be found on MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wua_sdk/wua/interfaces.asp The ones we can script in VBScript are: Microsoft.Update.AgentInfo Microsoft.Update.AutoUpdate Microsoft.Update.Downloader Microsoft.Update.Installer Microsoft.Update.Searcher Microsoft.Update.ServiceManager Microsoft.Update.Session Microsoft.Update.StringColl Microsoft.Update.SystemInfo Microsoft.Update.UpdateColl Microsoft.Update.WebProxy
  • 6. Remote WUA Client Install This script takes as input a text file with computer names, one per line. This script has no output. When run, the WUA client is installed with the /force switch to force the installation Additionally, BITS 2.0 and WinHTTP 5.1 are installed. These are prerequisites for the next scripts to work properly.
  • 8. Enumerate Installed Patches This script takes as input a text file with computer names, one per line. This script outputs a .CSV file showing each computer and the installed patches on that computer. Useful for auditing and compliance verification. Easy to generate.
  • 10. Enumerate Patches Not Installed This script takes as input a text file with computer names – one per line. This script outputs a .CSV file showing each computer and the patches not installed on that computer. If the computer is connected to a WSUS server, it will show those patches where the Action is set to Install. If the computer is not connected to a WSUS server, it will verify its patch status against WU. … where all patches have Action = “Install” Also easier than GUI tool. Slow.
  • 12. Multi-Machine On-Demand Patching (You Patch Now!) This script takes as input a text file with computer names, one per line. This script outputs a .CSV file showing each patch installed on that computer. The Microsoft.Update.UpdateColl object cannot be remotely created on the client. Thus, the download and install methods won ’t work. So, to fix this, the WSUS-install.vbs script actually launches the WSUS-install-agent.vbs script on each remote computer. Using PSExec! Man, I love PSExec! You can either run WSUS-install-agent.vbs directly on a machine or use WSUS-install.vbs to push it to a list of machines.
  • 15. Match q-Numbers to MS0x-0xx Numbers This script takes no input (but you ’ll need to point it to your WSUS server) This script outputs a .CSV file showing each Security update and the mapping between the knowledgebase article number (the q number) and the Microsoft advisory number (the MS number)
  • 17. This slide deck was used in one of our many conference presentations. We hope you enjoy it, and invite you to use it within your own organization however you like. For more information on our company, including information on private classes and upcoming conference appearances, please visit our Web site, www.ConcentratedTech.com . For links to newly-posted decks, follow us on Twitter: @concentrateddon or @concentratdgreg This work is copyright ©Concentrated Technology, LLC

Editor's Notes

  • #4: Greg Shields
  • #5: Greg Shields
  • #6: Greg Shields Very useful web site: Navigate to http://www.microsoft.com/technet/community/columns/scripts/default.mspx and search for the July, 2005 issue of the Scripting Guys Newsletter “Tales from the Script”. This issue gives some good, but basic scripts you can use. We ’ll expand on those scripts shortly – and add to them the ability to use them on remote machines! There are a number of objects that can be created on the client, but only a few that can be interfaced through VBScript. Below is the mapping between the objects you can interface in VBScript and their associated COM object: Microsoft.Update.AgentInfo iWindowsUpdateAgentInfo Microsoft.Update.AutoUpdate iAutomaticUpdates Microsoft.Update.Downloader iUpdateDownloader Microsoft.Update.Installer iUpdateInstaller Microsoft.Update.Searcher iUpdateSearcher Microsoft.Update.ServiceManager iUpdateServiceManager Microsoft.Update.Session iUpdateSession Microsoft.Update.StringColl iStringCollection Microsoft.Update.SystemInfo iSystemInformation Microsoft.Update.UpdateColl iUpdateCollection Microsoft.Update.WebProxy iWebProxy Information about all of these can be found at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wua_sdk/wua/interfaces.asp
  • #7: Greg Shields '========================================================================== ' ' VBScript Source File ' ' NAME: techmentor_wsus-install-client.vbs ' ' WARNING: This script is provided as-is with no implied or expressed ' warranties or guarantees of functionality. Use at your own risk. ' This script could lead to system problems or a system crash and ' the author of this script is not responsible or liable for any problems ' or errors associated with its use. Use of this script constitutes ' agreement with this warning. ' ' NOTE: This script installs the WUA client and its necessary pre-requisites ' onto a list of computers and reboots the computer. The individual ' pre-requisites noted below must be in the same folder as where the script is run. ' ' INPUTS: A filename of a text file that includes the computers you want ' to scan. One computer per line. ' ' OUTPUTS: None ' ' SYNTAX: techmentor_wsus-install-client.vbs computers.txt ' '==========================================================================
  • #8: Greg Shields strComputerList = WScript.Arguments.Item(0) strPreReq = "Windows2000-KB842773-x86-ENU.EXE" strPreReq2 = "WindowsInstaller-KB893803-v2-x86.exe" strAgent = "WindowsUpdateAgent20-x86.exe" Set objShell = CreateObject("WScript.Shell") Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile(strComputerList, 1, True) Do While f.AtEndOfLine <> True strComputer = f.ReadLine objShell.Run("psexec.exe \\\\" & strComputer & " -c " & strPreReq & " /quiet /norestart"), 0, True objShell.Run("psexec.exe \\\\" & strComputer & " -c " & strPreReq2 & " /quiet /norestart"), 0, True objShell.Run("psexec.exe \\\\" & strComputer & " -c " & strAgent & " /wuforce /quiet"), 0, True Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}!\\\\" & strComputer & "\\root\\cimv2") Set colOperatingSystems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem") For Each objOperatingSystem in colOperatingSystems objOperatingSystem.Reboot() Next Loop WScript.Echo "Done!"
  • #9: Greg Shields '========================================================================== ' ' VBScript Source File ' ' NAME: techmentor_wsus-detectinstalled.vbs ' ' WARNING: This script is provided as-is with no implied or expressed ' warranties or guarantees of functionality. Use at your own risk. ' This script could lead to system problems or a system crash and ' the author of this script is not responsible or liable for any problems ' or errors associated with its use. Use of this script constitutes ' agreement with this warning. ' ' NOTE: This script leverages the WUA client to identify the updates ' currently installed on a list of computers. ' ' INPUTS: A filename of a text file that includes the computers you want ' to scan. One computer per line. ' ' OUTPUTS: A .CSV file that includes each computer and the currently installed ' updates on that computer. ' ' SYNTAX: techmentor_wsus_detectinstalled.vbs computers.txt ' '==========================================================================
  • #10: Greg Shields strComputerList = WScript.Arguments.Item(0) Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile(strComputerList, 1, True) Set objTextFile = fso.OpenTextFile("OUTPUT.csv", 2, True) objTextFile.WriteLine("Computer Name,Update Title") Do While f.AtEndOfLine <> True strComputer = f.ReadLine Set objSession = CreateObject("Microsoft.Update.Session", strComputer) Set objSearcher = objSession.CreateUpdateSearcher() intHistoryCount = objSearcher.GetTotalHistoryCount Set colHistory = objSearcher.QueryHistory(0, intHistoryCount) For Each objHistory in colHistory objTextFile.WriteLine(strComputer & "," & Replace(objHistory.Title, ",", "")) Next Loop WScript.Echo "Done!"
  • #11: Greg Shields '========================================================================== ' ' VBScript Source File ' ' NAME: techmentor_wsus-detectNotInstalled.vbs ' ' WARNING: This script is provided as-is with no implied or expressed ' warranties or guarantees of functionality. Use at your own risk. ' This script could lead to system problems or a system crash and ' the author of this script is not responsible or liable for any problems ' or errors associated with its use. Use of this script constitutes ' agreement with this warning. ' ' NOTE: This script leverages the WUA client to identify the updates ' not installed on a list of computers. ' ' INPUTS: A filename of a text file that includes the computers you want ' to scan. One computer per line. ' ' OUTPUTS: A .CSV file that includes each computer and the currently ' uninstalled updates on that computer. ' ' SYNTAX: techmentor_wsus_detectNotInstalled.vbs computers.txt ' '==========================================================================
  • #12: Greg Shields strComputerList = WScript.Arguments.Item(0) Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile(strComputerList, 1, True) Set objTextFile = fso.OpenTextFile("OUTPUT.csv", 2, True) objTextFile.WriteLine("Computer Name,Update Title") Do While f.AtEndOfLine <> True strComputer = f.ReadLine Set objSession = CreateObject("Microsoft.Update.Session", strComputer) Set objSearcher = objSession.CreateUpdateSearcher() Set objResults = objSearcher.Search("Type='Software'") Set colUpdates = objResults.Updates For i = 0 to colUpdates.Count - 1 If colUpdates.Item(i).IsInstalled = FALSE Then objTextFile.WriteLine(strComputer & "," & colUpdates.Item(i).Title) End If Next Loop WScript.Echo "Done!"
  • #13: Greg Shields '========================================================================== ' ' VBScript Source File ' ' NAME: techmentor_wsus-install.vbs ' ' WARNING: This script is provided as-is with no implied or expressed ' warranties or guarantees of functionality. Use at your own risk. ' This script could lead to system problems or a system crash and ' the author of this script is not responsible or liable for any problems ' or errors associated with its use. Use of this script constitutes ' agreement with this warning. ' ' NOTE: This script leverages PSExec to remotely launch the 'install agent' ' on a list of remote computers. ' ' INPUTS: A filename of a text file that includes the computers you want ' to scan. One computer per line. Also, the username and password ' of the administrator in "domain\\username" format ' ' OUTPUTS: None ' ' SYNTAX: wsus-install.vbs computers.txt domain\\username PassWord! ' '==========================================================================
  • #14: Greg Shields strComputerList = WScript.Arguments.Item(0) strUserName = WScript.Arguments.Item(1) strPassword = WScript.Arguments.Item(2) strAgent = "techmentor_wsus-install-agent.vbs" Set objShell = CreateObject("WScript.Shell") Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile(strComputerList, 1, True) Do While f.AtEndOfLine <> True strComputer = f.ReadLine fso.CopyFile strAgent, "\\\\" & strComputer & "\\admin$\\system32\\", True WScript.Echo ("psexec.exe \\\\" & strComputer & " -u " & strUserName & " -p " & strPassword & " " & strAgent) Set objExecObject = objShell.Exec("psexec.exe \\\\" & strComputer & " -u " & strUserName & " -p " & strPassword & " cscript " & strAgent) Loop WScript.Echo "Done! “ '========================================================================== ' ' VBScript Source File ' ' NAME: techmentor_wsus-Install-agent.vbs ' ' WARNING: This script is provided as-is with no implied or expressed ' warranties or guarantees of functionality. Use at your own risk. ' This script could lead to system problems or a system crash and ' the author of this script is not responsible or liable for any problems ' or errors associated with its use. Use of this script constitutes ' agreement with this warning. ' ' NOTE: This script is the agent that actually downloads and installs the ' individual updates on each computer. This script leverages WUA to ' determine the necessary updates, install them, and reboot. A ' wuauclt /detectnow may be needed for the machine to upload its status ' back to the WSUS server. This script can either be run directly on ' a machine console or can be remotely run via techmentor_wsus-install.vbs. ' ' INPUTS: A filename of a text file that includes the computers you want ' to scan. One computer per line. ' ' OUTPUTS: None ' '========================================================================== Set fso = CreateObject("Scripting.FileSystemObject") Set objAutomaticUpdates = CreateObject("Microsoft.Update.AutoUpdate") objAutomaticUpdates.EnableService objAutomaticUpdates.DetectNow Set objSession = CreateObject("Microsoft.Update.Session") Set objSearcher = objSession.CreateUpdateSearcher() Set objResults = objSearcher.Search("IsInstalled=0 and Type='Software'") Set colUpdates = objResults.Updates
  • #15: Greg Shields Set objUpdatesToDownload = CreateObject("Microsoft.Update.UpdateColl") intUpdateCount = 0 For i = 0 to colUpdates.Count - 1 intUpdateCount = intUpdateCount + 1 Set objUpdate = colUpdates.Item(i) objUpdatesToDownload.Add(objUpdate) Next If intUpdateCount = 0 Then WScript.Quit Else Set objDownloader = objSession.CreateUpdateDownloader() objDownloader.Updates = objUpdatesToDownload objDownloader.Download() Set objInstaller = objSession.CreateUpdateInstaller() objInstaller.Updates = objUpdatesToDownload Set installationResult = objInstaller.Install() Set objSysInfo = CreateObject("Microsoft.Update.SystemInfo") If objSysInfo.RebootRequired Then Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}!\\\\localhost\\root\\cimv2") Set colOperatingSystems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem") For Each objOperatingSystem in colOperatingSystems objOperatingSystem.Reboot() Next End If End If
  • #16: Greg Shields '========================================================================== ' ' VBScript Source File ' ' NAME: techmentor_WSUS-QtoMSMatch.vbs ' ' WARNING: This script is provided as-is with no implied or expressed ' warranties or guarantees of functionality. Use at your own risk. ' This script could lead to system problems or a system crash and ' the author of this script is not responsible or liable for any problems ' or errors associated with its use. Use of this script constitutes ' agreement with this warning. ' ' NOTE: For this script to function when not run on the WSUS server, you will ' need to enable TCP/IP and/or Named Pipes connections. Configuring the ' WSUS server for mixed mode authentication may also be likely. ' ' INPUTS: None ' ' OUTPUTS: A .CSV file with the update title matched with the MS number. ' '==========================================================================
  • #17: Greg Shields strWSUSServer = “<Enter WSUS Server here>" Set fso = CreateObject("Scripting.FileSystemObject") Set objTextFile = fso.OpenTextFile("OUTPUT.csv", 2, True) objTextFile.WriteLine("MS Number,Q Number") Set conn = CreateObject("ADODB.Connection") Set rs = CreateObject("ADODB.Recordset") dbconn = "Driver={SQL Server};Server=" & strWSUSServer & ";Database=SUSDB" conn.open dbconn strSQLQuery = "SELECT dbo.tbSecurityBulletinForRevision.SecurityBulletinID, dbo.tbLocalizedProperty.Title FROM dbo.tbLocalizedPropertyForRevision INNER JOIN dbo.tbLocalizedProperty ON dbo.tbLocalizedPropertyForRevision.LocalizedPropertyID = dbo.tbLocalizedProperty.LocalizedPropertyID INNER JOIN dbo.tbSecurityBulletinForRevision ON dbo.tbLocalizedPropertyForRevision.RevisionID = dbo.tbSecurityBulletinForRevision.RevisionID WHERE (dbo.tbLocalizedPropertyForRevision.LanguageID = 1033) ORDER BY dbo.tbSecurityBulletinForRevision.SecurityBulletinID" rs.Open strSQLQuery, conn, 3, 3 While Not rs.EOF objTextFile.WriteLine(rs.Fields(0).Value & "," & Replace(rs.Fields(1).Value, ",", "")) rs.MoveNext Wend WScript.Echo "Done!"