SlideShare uma empresa Scribd logo
1 de 20
HOWTO: Install All Windows Updates in
Powershell Remotely
© Action1 Corporation. All rights reserved.
Timely updating the software installed in the company and installing the
required patches is one of the important tasks, the implementation of
which allows you to avoid various software malfunctions, as well as to
ensure an adequate level of security. How can you centrally and remotely
manage software updates and patches in a company? To do this, there
are various solutions called patch management tool. If you have ever had
to install Windows updates, as in patching servers, you know you have to
log into servers and allow updates to install, suppressing reboots along
the way. I will focus on windows update in powershell today (Invoke-
WUInstall), used to install Windows updates remotely.
action1.com
1. Installing PSWindowsUpdate PowerShell Module
Since PSWindowsUpdate is not installed on Windows by default, we
have to first install the module.PS C:WINDOWSsystem32> Install-
Module PSWindowsUpdate -MaximumVersion 1.5.2.6
If we run Get-Command we can see all of the commands in the
PSWindowsUpdate module:
PS C:WINDOWSsystem32> Get-Command -Module
PSWindowsUpdate
CommandType Name Version Source action1.com
Manually:
1. Installing PSWindowsUpdate PowerShell Module
----------- ---- ------- ------
Alias Get-WindowsUpdate 1.5.2.6 pswindowsupdate
Alias Hide-WindowsUpdate 1.5.2.6 pswindowsupdate
Alias Install-WindowsUpdate 1.5.2.6 pswindowsupdate
Alias Uninstall-WindowsUpdate 1.5.2.6 pswindowsupdate
Function Add-WUOfflineSync 1.5.2.6 pswindowsupdate
Function Add-WUServiceManager 1.5.2.6 pswindowsupdate
Function Get-WUHistory 1.5.2.6 pswindowsupdate
Function Get-WUInstall 1.5.2.6 pswindowsupdate action1.com
Manually:
1. Installing PSWindowsUpdate PowerShell Module
Function Get-WUInstallerStatus 1.5.2.6 pswindowsupdate
Function Get-WUList 1.5.2.6 pswindowsupdate
Function Get-WURebootStatus 1.5.2.6 pswindowsupdate
Function Get-WUServiceManager 1.5.2.6 pswindowsupdate
Function Get-WUUninstall 1.5.2.6 pswindowsupdate
Function Hide-WUUpdate 1.5.2.6 pswindowsupdate
Function Invoke-WUInstall 1.5.2.6 pswindowsupdate
Function Remove-WUOfflineSync 1.5.2.6 pswindowsupdate
Function Remove-WUServiceManager 1.5.2.6 pswindowsupdate
action1.com
Manually:
action1.com
Manually:
2. How Invoke-WUInstall Works
One different aspect of using Invoke-WUInstall is that it does not
use traditional remoting methods to perform Windows update in
PowerShell. When you look at the source code, it actually creates
and immediately runs a scheduled task on the remote machine
under the SYSTEM account.Write-Verbose "Create schedule service
object"
$Scheduler = New-Object -ComObject Schedule.Service
$Task = $Scheduler.NewTask(0)
$RegistrationInfo = $Task.RegistrationInfo action1.com
Manually:
2. How Invoke-WUInstall Works
$RegistrationInfo.Description = $TaskName
$RegistrationInfo.Author = $User.Name
$Settings = $Task.Settings
$Settings.Enabled = $True
$Settings.StartWhenAvailable = $True
$Settings.Hidden = $False
$Action = $Task.Actions.Create(0)
$Action.Path = "powershell"
$Action.Arguments = "-Command $Script"
$Task.Principal.RunLevel = 1
action1.com
Manually:
2. How Invoke-WUInstall Works
typical use of Invoke-WUInstall would be:
Invoke-WUInstall -ComputerName Test-1 -Script {ipmo
PSWindowsUpdate; Get-WUInstall -AcceptAll | Out-File
C:PSWindowsUpdate.log } -Confirm:$false –Verbose
In this command we see Get-WUInstall, which is the command
PSWindowsUpdate uses to install updates, usually from your Windows
Server Update Services (WSUS) server. Get-WUInstall simply uses a COM
object for Windows updates to perform the tasks needed. Notice also
the use of the -AcceptAll parameter, which means it will automatically
accept any updates to install. action1.com
Manually:
2. How Invoke-WUInstall Works
One nice feature of Invoke-WUInstall is that it actually installs the
PSWindowsUpdate module on the remote machine (if it isn't there
already). This is great when you are using the module on a new machine,
or when you decide to use it for the first time.
C: > $cim = New-CimSession -ComputerName Test-1
C: > $cim
Id : 2
Name : CimSession2
InstanceId : afa8c63d-fb1f-46f9-8082-c66238750a92
ComputerName : Test-1
Protocol : WSMAN
action1.com
Manually:
2. How Invoke-WUInstall Works
C:ScriptsPowerShell> (Get-ScheduledTask -TaskPath "" -
CimSession $cim -TaskName PSWindowsUpdate).actions
Id :
Arguments : -Command ipmo PSWindowsUpdate; Get-WUInstall -
AcceptAll -AutoReboot | Out-File C:PSWindowsUpdate.log
Execute : powershell
WorkingDirectory :
PSComputerName : Test-1 action1.com
Manually:
2. How Invoke-WUInstall Works
As you can see, the scheduled task is going to run ipmo
PSWindowsUpdate; Get-WUInstall -AcceptAll -AutoReboot | Out-
File C:PSWindowsUpdate.log. Using Out-File will ensure the logs
of downloading and installing updates are visible so we can check
against them later.
action1.com
Manually:
action1.com
Manually:
3. Install Updates on Multiple Machines
The true power of Invoke-WUInstall is when you have to install
updates on many machines at once. This is very easy to do, all
you need is to add machines to the -ComputerName parameter,
which then processes them in a loop (not in parallel
unfortunately).
action1.com
Manually:
3. Install Updates on Multiple Machines
C: > Invoke-WUInstall -ComputerName Test-1,Test-2,Test-3,Test-4 -Script
{ipmo PSWindowsUpdate; Get-WUInstall -AcceptAll | Out-File C:
PSWindowsUpdate.log } -Confirm:$false -Verbose
VERBOSE: Populating RepositorySourceLocation property for module
PSWindowsUpdate.
VERBOSE: Loading module from path 'C:Program
FilesWindowsPowerShellModulesPSWindowsUpdate1.5.2.6PSWindows
Update.psm1'.
VERBOSE: Create schedule service object
VERBOSE: Performing the operation "Invoke WUInstall" on target "Test-1".
action1.com
Manually:
4. Windows Update in Powershell: Finding Errors
One great reason to output to a log on the remote machine is to
confirm that no errors installing updates on these remote
machines occurred. With some simple PowerShell, we can query
these log files and search for failures.Here is what a typical log
looks like after using Get-WUInstall -AcceptAll | Out-File C:
PSWindowsUpdate.log:
It includes the status of the update, its KB number, size, and title—
all great information to have handy when installing updates.
action1.com
Manually:
4. Windows Update in Powershell: Finding Errors
Using Invoke-Command, Get-Item, and Select-String, we can use a quick
technique to easily work through any computers used with Invoke-WUInstall
and check for updates that failed to install:
C:> Invoke-Command -ComputerName Test-1,Test-2,Test-3 -ScriptBlock {
>> Get-Item C:PSWindowsUpdate.log | Select-String -Pattern "failed" -
SimpleMatch |
>> Select-Object -Property line } | Select-Object -Property
Line,PSComputerName
Line PSComputerName
4 Failed KB4103712 30 MB 2018-05 Security Only Quality Update for
Windo... Test-1 action1.com
Manually:
Other Relevant HOWTOs:
action1.com
How to Uninstall Software Remotely Using Command Line Tool
Free Tool: Install Patch Remotely
Free Tool: Run Scheduled Task Remotely
Free Tool: Set Share Permissions
Free Tool: Web Browsers
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

Mais conteúdo relacionado

Último

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 

Último (20)

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

Destaque

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
 

Destaque (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: Install All Windows Updates in Powershell Remotely

  • 1. HOWTO: Install All Windows Updates in Powershell Remotely © Action1 Corporation. All rights reserved.
  • 2. Timely updating the software installed in the company and installing the required patches is one of the important tasks, the implementation of which allows you to avoid various software malfunctions, as well as to ensure an adequate level of security. How can you centrally and remotely manage software updates and patches in a company? To do this, there are various solutions called patch management tool. If you have ever had to install Windows updates, as in patching servers, you know you have to log into servers and allow updates to install, suppressing reboots along the way. I will focus on windows update in powershell today (Invoke- WUInstall), used to install Windows updates remotely. action1.com
  • 3. 1. Installing PSWindowsUpdate PowerShell Module Since PSWindowsUpdate is not installed on Windows by default, we have to first install the module.PS C:WINDOWSsystem32> Install- Module PSWindowsUpdate -MaximumVersion 1.5.2.6 If we run Get-Command we can see all of the commands in the PSWindowsUpdate module: PS C:WINDOWSsystem32> Get-Command -Module PSWindowsUpdate CommandType Name Version Source action1.com Manually:
  • 4. 1. Installing PSWindowsUpdate PowerShell Module ----------- ---- ------- ------ Alias Get-WindowsUpdate 1.5.2.6 pswindowsupdate Alias Hide-WindowsUpdate 1.5.2.6 pswindowsupdate Alias Install-WindowsUpdate 1.5.2.6 pswindowsupdate Alias Uninstall-WindowsUpdate 1.5.2.6 pswindowsupdate Function Add-WUOfflineSync 1.5.2.6 pswindowsupdate Function Add-WUServiceManager 1.5.2.6 pswindowsupdate Function Get-WUHistory 1.5.2.6 pswindowsupdate Function Get-WUInstall 1.5.2.6 pswindowsupdate action1.com Manually:
  • 5. 1. Installing PSWindowsUpdate PowerShell Module Function Get-WUInstallerStatus 1.5.2.6 pswindowsupdate Function Get-WUList 1.5.2.6 pswindowsupdate Function Get-WURebootStatus 1.5.2.6 pswindowsupdate Function Get-WUServiceManager 1.5.2.6 pswindowsupdate Function Get-WUUninstall 1.5.2.6 pswindowsupdate Function Hide-WUUpdate 1.5.2.6 pswindowsupdate Function Invoke-WUInstall 1.5.2.6 pswindowsupdate Function Remove-WUOfflineSync 1.5.2.6 pswindowsupdate Function Remove-WUServiceManager 1.5.2.6 pswindowsupdate action1.com Manually:
  • 7. 2. How Invoke-WUInstall Works One different aspect of using Invoke-WUInstall is that it does not use traditional remoting methods to perform Windows update in PowerShell. When you look at the source code, it actually creates and immediately runs a scheduled task on the remote machine under the SYSTEM account.Write-Verbose "Create schedule service object" $Scheduler = New-Object -ComObject Schedule.Service $Task = $Scheduler.NewTask(0) $RegistrationInfo = $Task.RegistrationInfo action1.com Manually:
  • 8. 2. How Invoke-WUInstall Works $RegistrationInfo.Description = $TaskName $RegistrationInfo.Author = $User.Name $Settings = $Task.Settings $Settings.Enabled = $True $Settings.StartWhenAvailable = $True $Settings.Hidden = $False $Action = $Task.Actions.Create(0) $Action.Path = "powershell" $Action.Arguments = "-Command $Script" $Task.Principal.RunLevel = 1 action1.com Manually:
  • 9. 2. How Invoke-WUInstall Works typical use of Invoke-WUInstall would be: Invoke-WUInstall -ComputerName Test-1 -Script {ipmo PSWindowsUpdate; Get-WUInstall -AcceptAll | Out-File C:PSWindowsUpdate.log } -Confirm:$false –Verbose In this command we see Get-WUInstall, which is the command PSWindowsUpdate uses to install updates, usually from your Windows Server Update Services (WSUS) server. Get-WUInstall simply uses a COM object for Windows updates to perform the tasks needed. Notice also the use of the -AcceptAll parameter, which means it will automatically accept any updates to install. action1.com Manually:
  • 10. 2. How Invoke-WUInstall Works One nice feature of Invoke-WUInstall is that it actually installs the PSWindowsUpdate module on the remote machine (if it isn't there already). This is great when you are using the module on a new machine, or when you decide to use it for the first time. C: > $cim = New-CimSession -ComputerName Test-1 C: > $cim Id : 2 Name : CimSession2 InstanceId : afa8c63d-fb1f-46f9-8082-c66238750a92 ComputerName : Test-1 Protocol : WSMAN action1.com Manually:
  • 11. 2. How Invoke-WUInstall Works C:ScriptsPowerShell> (Get-ScheduledTask -TaskPath "" - CimSession $cim -TaskName PSWindowsUpdate).actions Id : Arguments : -Command ipmo PSWindowsUpdate; Get-WUInstall - AcceptAll -AutoReboot | Out-File C:PSWindowsUpdate.log Execute : powershell WorkingDirectory : PSComputerName : Test-1 action1.com Manually:
  • 12. 2. How Invoke-WUInstall Works As you can see, the scheduled task is going to run ipmo PSWindowsUpdate; Get-WUInstall -AcceptAll -AutoReboot | Out- File C:PSWindowsUpdate.log. Using Out-File will ensure the logs of downloading and installing updates are visible so we can check against them later. action1.com Manually:
  • 14. 3. Install Updates on Multiple Machines The true power of Invoke-WUInstall is when you have to install updates on many machines at once. This is very easy to do, all you need is to add machines to the -ComputerName parameter, which then processes them in a loop (not in parallel unfortunately). action1.com Manually:
  • 15. 3. Install Updates on Multiple Machines C: > Invoke-WUInstall -ComputerName Test-1,Test-2,Test-3,Test-4 -Script {ipmo PSWindowsUpdate; Get-WUInstall -AcceptAll | Out-File C: PSWindowsUpdate.log } -Confirm:$false -Verbose VERBOSE: Populating RepositorySourceLocation property for module PSWindowsUpdate. VERBOSE: Loading module from path 'C:Program FilesWindowsPowerShellModulesPSWindowsUpdate1.5.2.6PSWindows Update.psm1'. VERBOSE: Create schedule service object VERBOSE: Performing the operation "Invoke WUInstall" on target "Test-1". action1.com Manually:
  • 16. 4. Windows Update in Powershell: Finding Errors One great reason to output to a log on the remote machine is to confirm that no errors installing updates on these remote machines occurred. With some simple PowerShell, we can query these log files and search for failures.Here is what a typical log looks like after using Get-WUInstall -AcceptAll | Out-File C: PSWindowsUpdate.log: It includes the status of the update, its KB number, size, and title— all great information to have handy when installing updates. action1.com Manually:
  • 17. 4. Windows Update in Powershell: Finding Errors Using Invoke-Command, Get-Item, and Select-String, we can use a quick technique to easily work through any computers used with Invoke-WUInstall and check for updates that failed to install: C:> Invoke-Command -ComputerName Test-1,Test-2,Test-3 -ScriptBlock { >> Get-Item C:PSWindowsUpdate.log | Select-String -Pattern "failed" - SimpleMatch | >> Select-Object -Property line } | Select-Object -Property Line,PSComputerName Line PSComputerName 4 Failed KB4103712 30 MB 2018-05 Security Only Quality Update for Windo... Test-1 action1.com Manually:
  • 18. Other Relevant HOWTOs: action1.com How to Uninstall Software Remotely Using Command Line Tool Free Tool: Install Patch Remotely Free Tool: Run Scheduled Task Remotely Free Tool: Set Share Permissions Free Tool: Web Browsers
  • 19. Sign Up for Action1 • Instant sign-up • No phone calls to activate • Quick configuration Go to action1.com/free
  • 20. Free Help • Call 1-346-444-8530 • action1.com/contact_us.html • Free technical support action1.com

Notas do 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.