SlideShare una empresa de Scribd logo
1 de 34
HOWTO: Powershell Script to Install
Windows Updates Remotely
© Action1 Corporation. All rights reserved.
It is very convenient to use a special PowerShell script-
PSWindowsUpdate to install Windows updates remotely from
the command line on a separate computer. The
PSWindowsUpdate module is not built into Windows and it is
a third-party module available in the Technet Script Gallery.
PSWindowsUpdate allows administrators to remotely check
for updates on computers and workstations, install, remove
and hide certain updates.
action1.com
The PSWindowsUpdate module is especially valuable when
used to manage Windows updates in the Core editions of
Windows Server, which do not have a graphical interface, as
well as when setting up a Windows image in audit mode.
In this presentation, I show a Powershell script to install
Windows Updates remotely also you will find another module
which helps to get a list of all the missing Windows updates.
action1.com
1. Installing the Update Management Module
PsWindowsUpdate
If you have Windows 10 installed, you can install the
PSWindowsUpdate module from the online repository via the
Package Manager PackageManagement with just one
command:Install-Module -Name PSWindowsUpdate
Manually:
action1.com
1. Installing the Update Management Module
PsWindowsUpdate
If you have an older version of Windows (Windows 7 / 8.1 /
Windows Server 2008 R2 / 2012 R2) or do not have direct
Internet access, you can install the PSWindowsUpdate module
manually.
This module can be installed on any supported version of
Windows, starting with Vista / Windows Server 2008 with
PowerShell 2.0 installed (but PoSh 3.0 and higher is
recommended).
Manually:
action1.com
1. Installing the Update Management Module
PsWindowsUpdate
- Download the latest version of the PSWindowsUpdate module
from the page:
https://gallery.technet.microsoft.com/scriptcenter/2d191bcd-
3308-4edd-9de2-88dff796b0bc and unlock the downloaded file.
Manually:
action1.com
Manually:
action1.com
1. Installing the Update Management Module
PsWindowsUpdate
- Unpack the archive with the module into one of the%
USERPROFILE%  Documents  WindowsPowerShell  Modules
or% WINDIR%  System32  WindowsPowerShell  v1.0 
Modules directories (using the module permanently is the best
option).
- Allow script execution: Set-ExecutionPolicy RemoteSigned
- Now you can import a module into your PowerShell session:
Import-Module PSWindowsUpdate
Manually:
action1.com
Manually:
action1.com
1. Installing the Update Management Module
PsWindowsUpdate
Note. In Windows 7 / Server 2008 R2, when importing a
PSWindowsUpdate module, you may encounter an error like
the following: The name “Unblock-File” is not recognized as the
name of the cmdlet. The point is that the module uses some
functions that appeared only in PowerShell 3.0. To use these
functions, you will have to update PowerShell, or manually
remove the line | Unblock-File from the
PSWindowsUpdate.psm1 file.
Manually:
action1.com
1. Installing the Update Management Module
PsWindowsUpdate
If you installed the Windows Update Management Module on
your computer, you can install it remotely on other computers
and / or servers. Use this script to copy the module to the two
specified remote servers:
Manually:
action1.com
1. Installing the Update Management Module
PsWindowsUpdate
$ Targets = "Server1", "Server2" Update-WUModule -
LocalPSWUSource "C:  Windows  system32 
WindowsPowerShell  v1.0  Modules  PSWindowsUpdate" -
ComputerName $ Targets
Invoke-Command -ComputerName $ Targets -ScriptBlock {Add-
Content $ Env: WINDIR  system32  WindowsPowerShell  v1.0
 profile.ps1 "` `nImport-Module PSWindowsUpdate"}
Manually:
action1.com
2. Overview Module PSWindowsUpdate Commands
The list of available cmdlets for the module can be displayed
as:get-command-module PSWindowsUpdate
Briefly describe the purpose of the module commands:
Get-WindowsUpdate - an alias for Get-WUList.
Hide-WindowsUpdate - alias for Hide-WUUpdate.
Install-WindowsUpdate - alias for Get-WUInstall.
Uninstall-WindowsUpdate - alias for Get-WUUninstall.
Manually:
action1.com
2. Overview Module PSWindowsUpdate Commands
Add-WUOfflineSync - the function allows you to install updates
from the local cache using the file wsusscan.cab or
wsusscn2.cab.
Add-WUServiceManager - register the update server on a
computer.
Get-WUHistory - displays a list of installed updates.
Manually:
action1.com
2. Overview Module PSWindowsUpdate Commands
Get-WUInstall is the main cmdlet of the PSWindowsUpdate
module. Allows you to download and install updates from the
server WSUS or Microsoft Update. Allows you to select
categories of updates, specific updates and specify the rules for
restarting the computer when installing updates.
Get-WUInstallerStatus - check the status of the Windows
Installer service.
Manually:
action1.com
2. Overview Module PSWindowsUpdate Commands
Get-WURebootStatus - allows you to check whether a reboot is
necessary to apply a specific update.
Get-WUList - lists the updates that meet the specified criteria,
allows you to find and install the desired update.
Get-WUServiceManager - check for update sources.
Get-WUUninstall - cmdlet allows you to remove a specific
update by KB ID.
Manually:
action1.com
2. Overview Module PSWindowsUpdate Commands
Hide-WUUpdate - allows you to hide certain updates from the
installation.
Invoke-WUInstall - manage remote installation of updates.
Remove-WUOfflineSync - remove offline scan source.
Remove-WUServiceManager - remove update server.
Manually:
action1.com
Manually:
action1.com
3. Get a List of Available Updates for the Computer
List the available updates for your computer on the update
server:Get-WUInstall -ListOnly
To check the list of available updates on a remote computer,
run:
Get-WUList –ComputerName server2
You can check where your Windows should get updates from.
Run the command:
Get-WUServiceManager
ServiceID IsManaged IsDefault Name
Manually:
action1.com
Manually:
action1.com
3. Get a List of Available Updates for the Computer
As you can see, the computer is configured to receive updates
from the local WSUS and Windows Update service. If you want
to scan your computer on Microsoft Update servers (besides
Windows updates, these servers contain Office updates and
other products) on the Internet, run the following command:
Get-WUinstall -MicrosoftUpdate –ListOnly
You get a warning:
Can’t find registered service Microsoft Update. Use Get-
WUServiceManager to get registered service.
Manually:
action1.com
3. Get a List of Available Updates for the Computer
To enable scanning on Microsoft Update, run the following
command:
Add-WUServiceManager -ServiceID "7971f918-a847-4430-
9279-4a52d1efe18d" -AddServiceFlag 7
Now you can perform a scan on Microsoft Update.
Manually:
action1.com
3. Get a List of Available Updates for the Computer
To remove certain products or specific packages from the list of
updates your computer receives, you can exclude them by:
- Categories (-NotCategory);
- Name (-NotTitle);
- Update number (-NotKBArticleID).
For example, exclude from the list of updates for drivers,
OneDrive, and one specific KB:
Get-WUInstall -NotCategory "Drivers" -NotTitle OneDrive -
NotKBArticleID KB4011670 -ListOnly
Manually:
action1.com
4. Powershell Script to Install Windows Updates Remotely –
PsWindowsUpdate
To automatically download and install all available updates for
your operating system, run:Get-WUInstall -AcceptAll –
IgnoreReboot
The AcceptAll key includes installation approval for all packages,
and IgnoreReboot suppresses automatic restarts of Windows
after installing updates.
Manually:
action1.com
4. Powershell Script to Install Windows Updates Remotely –
PsWindowsUpdate
You can install only specific update packages:
Get-WUInstall -KBArticleID KB4011670,KB4456655 –AcceptAll
If you want to remove some updates from the installation list,
run:
Get-WUInstall -NotCategory "Drivers" -NotTitle OneDrive -
NotKBArticleID KB4011670 -AcceptAll -IgnoreReboot
Manually:
action1.com
4. Powershell Script to Install Windows Updates Remotely –
PsWindowsUpdate
To automate the installation of updates with exceptions on
multiple computers, you can use the following script:
PowerShell -ExecutionPolicy RemoteSigned -Command Import-
Module PSWindowsUpdate; Get-WUInstall -NotCategory
"Language packs" -NotTitle OneDrive -NotKBArticleID
KB4011670 -AcceptAll –IgnoreReboot
Manually:
action1.com
4. Powershell Script to Install Windows Updates Remotely –
PsWindowsUpdate
The module allows you to remotely start the installation of
updates on several computers at once or on a server (the
PSWindowsUpdate module should be present on the computers).
The following command will install all available updates on three
remote servers:
Invoke-WUInstall -ComputerName server1, server2, server1-Script
{ipmo PSWindowsUpdate; Get-WUInstall -AcceptAll -AutoReboot
| Out-File C:WindowsPSWindowsUpdate.log } -Confirm:$false -
Verbose -SkipModuleTest –RunNow
Manually:
action1.com
5. View the History of Installed Updates
Using the Get-WUHistory command, you can get a list of updates
installed on your computer earlier. You can get information about
the date of installation of a specific update:Get-WUHistory|
Where-Object {$_.Title -match "KB4011*"} | Select-Object *|ft
To obtain information about the presence of an installed update
on several remote computers, you can use the following code:
"server1","server2" | Get-WUHistory| Where-Object {$_.Title -
match "KB4011634"} | Select-Object *|ft
Manually:
action1.com
6. The Next Feature Is Uninstalling Updates
To remove updates, use the Remove-WindowsUpdate cmdlet.
You only need to specify the KB number as an argument to the
KBArticleID parameter. To postpone the automatic restart of the
computer, you can add the –NoRestart key:Remove-
WindowsUpdate -KBArticleID KB4011634 -NoRestart
Manually:
action1.com
7. How to Hide Unnecessary Updates Using Powershell
You can hide certain updates so that they are never installed by
Windows Update on your computer. For example, to hide the
KB4011670 and KB4456655 updates, run the following
commands:$HideList = "KB4011670", "KB4456655"
Hide-WindowsUpdate -KBArticleID $HideList –Hide
Manually:
action1.com
7. How to Hide Unnecessary Updates Using Powershell
The next time you scan for updates using the Get-WUInstall –
ListOnly command, hidden updates will not be displayed in the
list of patches available for installation.
You can list the updates that are hidden on this computer as
follows:
Get-WindowsUpdate -IsHidden
To remove updates from hidden, run:
Hide-WindowsUpdate -KBArticleID $HideList -Hide:$false
Manually:
action1.com
Other Relevant HOWTOs:
How to Restart Remote Computer
Free Tool: Install Patch Remotely
Free Tool: Run Scheduled Task Remotely
Free Tool: Set Share Permissions
Free Tool: Web Browsers
action1.com
Sign Up for Action1
• Instant sign-up
• No phone calls to activate
• Quick configuration
Go to action1.com/free
Free Help
• Call 1-346-444-8530
• action1.com/contact_us.html
• Free technical support
action1.com

Más contenido relacionado

Último

DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Último (20)

DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

Destacado

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 

Destacado (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

HOWTO: Powershell Script to Install Windows Updates Remotely

  • 1. HOWTO: Powershell Script to Install Windows Updates Remotely © Action1 Corporation. All rights reserved.
  • 2. It is very convenient to use a special PowerShell script- PSWindowsUpdate to install Windows updates remotely from the command line on a separate computer. The PSWindowsUpdate module is not built into Windows and it is a third-party module available in the Technet Script Gallery. PSWindowsUpdate allows administrators to remotely check for updates on computers and workstations, install, remove and hide certain updates. action1.com
  • 3. The PSWindowsUpdate module is especially valuable when used to manage Windows updates in the Core editions of Windows Server, which do not have a graphical interface, as well as when setting up a Windows image in audit mode. In this presentation, I show a Powershell script to install Windows Updates remotely also you will find another module which helps to get a list of all the missing Windows updates. action1.com
  • 4. 1. Installing the Update Management Module PsWindowsUpdate If you have Windows 10 installed, you can install the PSWindowsUpdate module from the online repository via the Package Manager PackageManagement with just one command:Install-Module -Name PSWindowsUpdate Manually: action1.com
  • 5. 1. Installing the Update Management Module PsWindowsUpdate If you have an older version of Windows (Windows 7 / 8.1 / Windows Server 2008 R2 / 2012 R2) or do not have direct Internet access, you can install the PSWindowsUpdate module manually. This module can be installed on any supported version of Windows, starting with Vista / Windows Server 2008 with PowerShell 2.0 installed (but PoSh 3.0 and higher is recommended). Manually: action1.com
  • 6. 1. Installing the Update Management Module PsWindowsUpdate - Download the latest version of the PSWindowsUpdate module from the page: https://gallery.technet.microsoft.com/scriptcenter/2d191bcd- 3308-4edd-9de2-88dff796b0bc and unlock the downloaded file. Manually: action1.com
  • 8. 1. Installing the Update Management Module PsWindowsUpdate - Unpack the archive with the module into one of the% USERPROFILE% Documents WindowsPowerShell Modules or% WINDIR% System32 WindowsPowerShell v1.0 Modules directories (using the module permanently is the best option). - Allow script execution: Set-ExecutionPolicy RemoteSigned - Now you can import a module into your PowerShell session: Import-Module PSWindowsUpdate Manually: action1.com
  • 10. 1. Installing the Update Management Module PsWindowsUpdate Note. In Windows 7 / Server 2008 R2, when importing a PSWindowsUpdate module, you may encounter an error like the following: The name “Unblock-File” is not recognized as the name of the cmdlet. The point is that the module uses some functions that appeared only in PowerShell 3.0. To use these functions, you will have to update PowerShell, or manually remove the line | Unblock-File from the PSWindowsUpdate.psm1 file. Manually: action1.com
  • 11. 1. Installing the Update Management Module PsWindowsUpdate If you installed the Windows Update Management Module on your computer, you can install it remotely on other computers and / or servers. Use this script to copy the module to the two specified remote servers: Manually: action1.com
  • 12. 1. Installing the Update Management Module PsWindowsUpdate $ Targets = "Server1", "Server2" Update-WUModule - LocalPSWUSource "C: Windows system32 WindowsPowerShell v1.0 Modules PSWindowsUpdate" - ComputerName $ Targets Invoke-Command -ComputerName $ Targets -ScriptBlock {Add- Content $ Env: WINDIR system32 WindowsPowerShell v1.0 profile.ps1 "` `nImport-Module PSWindowsUpdate"} Manually: action1.com
  • 13. 2. Overview Module PSWindowsUpdate Commands The list of available cmdlets for the module can be displayed as:get-command-module PSWindowsUpdate Briefly describe the purpose of the module commands: Get-WindowsUpdate - an alias for Get-WUList. Hide-WindowsUpdate - alias for Hide-WUUpdate. Install-WindowsUpdate - alias for Get-WUInstall. Uninstall-WindowsUpdate - alias for Get-WUUninstall. Manually: action1.com
  • 14. 2. Overview Module PSWindowsUpdate Commands Add-WUOfflineSync - the function allows you to install updates from the local cache using the file wsusscan.cab or wsusscn2.cab. Add-WUServiceManager - register the update server on a computer. Get-WUHistory - displays a list of installed updates. Manually: action1.com
  • 15. 2. Overview Module PSWindowsUpdate Commands Get-WUInstall is the main cmdlet of the PSWindowsUpdate module. Allows you to download and install updates from the server WSUS or Microsoft Update. Allows you to select categories of updates, specific updates and specify the rules for restarting the computer when installing updates. Get-WUInstallerStatus - check the status of the Windows Installer service. Manually: action1.com
  • 16. 2. Overview Module PSWindowsUpdate Commands Get-WURebootStatus - allows you to check whether a reboot is necessary to apply a specific update. Get-WUList - lists the updates that meet the specified criteria, allows you to find and install the desired update. Get-WUServiceManager - check for update sources. Get-WUUninstall - cmdlet allows you to remove a specific update by KB ID. Manually: action1.com
  • 17. 2. Overview Module PSWindowsUpdate Commands Hide-WUUpdate - allows you to hide certain updates from the installation. Invoke-WUInstall - manage remote installation of updates. Remove-WUOfflineSync - remove offline scan source. Remove-WUServiceManager - remove update server. Manually: action1.com
  • 19. 3. Get a List of Available Updates for the Computer List the available updates for your computer on the update server:Get-WUInstall -ListOnly To check the list of available updates on a remote computer, run: Get-WUList –ComputerName server2 You can check where your Windows should get updates from. Run the command: Get-WUServiceManager ServiceID IsManaged IsDefault Name Manually: action1.com
  • 21. 3. Get a List of Available Updates for the Computer As you can see, the computer is configured to receive updates from the local WSUS and Windows Update service. If you want to scan your computer on Microsoft Update servers (besides Windows updates, these servers contain Office updates and other products) on the Internet, run the following command: Get-WUinstall -MicrosoftUpdate –ListOnly You get a warning: Can’t find registered service Microsoft Update. Use Get- WUServiceManager to get registered service. Manually: action1.com
  • 22. 3. Get a List of Available Updates for the Computer To enable scanning on Microsoft Update, run the following command: Add-WUServiceManager -ServiceID "7971f918-a847-4430- 9279-4a52d1efe18d" -AddServiceFlag 7 Now you can perform a scan on Microsoft Update. Manually: action1.com
  • 23. 3. Get a List of Available Updates for the Computer To remove certain products or specific packages from the list of updates your computer receives, you can exclude them by: - Categories (-NotCategory); - Name (-NotTitle); - Update number (-NotKBArticleID). For example, exclude from the list of updates for drivers, OneDrive, and one specific KB: Get-WUInstall -NotCategory "Drivers" -NotTitle OneDrive - NotKBArticleID KB4011670 -ListOnly Manually: action1.com
  • 24. 4. Powershell Script to Install Windows Updates Remotely – PsWindowsUpdate To automatically download and install all available updates for your operating system, run:Get-WUInstall -AcceptAll – IgnoreReboot The AcceptAll key includes installation approval for all packages, and IgnoreReboot suppresses automatic restarts of Windows after installing updates. Manually: action1.com
  • 25. 4. Powershell Script to Install Windows Updates Remotely – PsWindowsUpdate You can install only specific update packages: Get-WUInstall -KBArticleID KB4011670,KB4456655 –AcceptAll If you want to remove some updates from the installation list, run: Get-WUInstall -NotCategory "Drivers" -NotTitle OneDrive - NotKBArticleID KB4011670 -AcceptAll -IgnoreReboot Manually: action1.com
  • 26. 4. Powershell Script to Install Windows Updates Remotely – PsWindowsUpdate To automate the installation of updates with exceptions on multiple computers, you can use the following script: PowerShell -ExecutionPolicy RemoteSigned -Command Import- Module PSWindowsUpdate; Get-WUInstall -NotCategory "Language packs" -NotTitle OneDrive -NotKBArticleID KB4011670 -AcceptAll –IgnoreReboot Manually: action1.com
  • 27. 4. Powershell Script to Install Windows Updates Remotely – PsWindowsUpdate The module allows you to remotely start the installation of updates on several computers at once or on a server (the PSWindowsUpdate module should be present on the computers). The following command will install all available updates on three remote servers: Invoke-WUInstall -ComputerName server1, server2, server1-Script {ipmo PSWindowsUpdate; Get-WUInstall -AcceptAll -AutoReboot | Out-File C:WindowsPSWindowsUpdate.log } -Confirm:$false - Verbose -SkipModuleTest –RunNow Manually: action1.com
  • 28. 5. View the History of Installed Updates Using the Get-WUHistory command, you can get a list of updates installed on your computer earlier. You can get information about the date of installation of a specific update:Get-WUHistory| Where-Object {$_.Title -match "KB4011*"} | Select-Object *|ft To obtain information about the presence of an installed update on several remote computers, you can use the following code: "server1","server2" | Get-WUHistory| Where-Object {$_.Title - match "KB4011634"} | Select-Object *|ft Manually: action1.com
  • 29. 6. The Next Feature Is Uninstalling Updates To remove updates, use the Remove-WindowsUpdate cmdlet. You only need to specify the KB number as an argument to the KBArticleID parameter. To postpone the automatic restart of the computer, you can add the –NoRestart key:Remove- WindowsUpdate -KBArticleID KB4011634 -NoRestart Manually: action1.com
  • 30. 7. How to Hide Unnecessary Updates Using Powershell You can hide certain updates so that they are never installed by Windows Update on your computer. For example, to hide the KB4011670 and KB4456655 updates, run the following commands:$HideList = "KB4011670", "KB4456655" Hide-WindowsUpdate -KBArticleID $HideList –Hide Manually: action1.com
  • 31. 7. How to Hide Unnecessary Updates Using Powershell The next time you scan for updates using the Get-WUInstall – ListOnly command, hidden updates will not be displayed in the list of patches available for installation. You can list the updates that are hidden on this computer as follows: Get-WindowsUpdate -IsHidden To remove updates from hidden, run: Hide-WindowsUpdate -KBArticleID $HideList -Hide:$false Manually: action1.com
  • 32. Other Relevant HOWTOs: How to Restart Remote Computer Free Tool: Install Patch Remotely Free Tool: Run Scheduled Task Remotely Free Tool: Set Share Permissions Free Tool: Web Browsers action1.com
  • 33. Sign Up for Action1 • Instant sign-up • No phone calls to activate • Quick configuration Go to action1.com/free
  • 34. Free Help • Call 1-346-444-8530 • action1.com/contact_us.html • Free technical support action1.com

Notas del editor

  1. Introducing Action One. Cloud-based endpoint security management.
  2. To get started, just go to Action One dot com slash free, enter your email, confirm it and you are in. Basic configuration takes only a few minutes.
  3. Feel free to call us or contact via Action One dot com. We can you help you to get started at absolutely no cost to you.