{"componentChunkName":"component---src-templates-articles-index-jsx","path":"/articles/patch-rollout-plan-powershell/","result":{"data":{"props":{"adsense":false,"adsenseMobile":null,"byLine":"","canonical":"https://staging.business.com/articles/patch-rollout-plan-powershell/","content":"\n<p>Deploying patches is a task many IT administrators must endure every month. There are many commercial tools out there to ease this process, but some are expensive, bloated or overkill for simple patching that a smaller company may need.</p>\r\n<p>Using PowerShell, we can develop a patch deployment strategy and automate the process – just like the big tools – with little more than some sweat equity and time.</p>\r\n<h2>Prerequisites</h2>\r\n<p>To ensure you can start with everything configured as needed, you'll need a few things. First, you'll need PowerShell. We'll be using Windows PowerShell 5.1. I am assuming you've already got PowerShell Remoting available on all of your clients, you've got appropriate rights to query and install patches on systems, you're in an Active Directory environment, and you've got the Remote Server Administration Tools package installed.</p>\r\n<h2>Discovering the environment and testing</h2>\r\n<p>To ensure we test the most significant and most applicable sample of computers across our network, we first need to identify what systems are out there. Picking various configurations to test, such as Windows settings and software installed, across computers is an organizational choice, but typically, we'll need to find all of the operating systems we have to ensure patches don't break these systems when deployed to all systems.</p>\r\n<p>We can use PowerShell to query our Active Directory environment to return all groups of computers with a specific operating system. For example, the below code will return two test systems by operating systems across all of your Active Directory computers.</p>\r\n<p><picture class=\"aligncenter med\"><source srcset=\"/images/content/5ca/cbe795a215e264b8b45b8/742_-261- 742w, /images/content/5ca/cbe795a215e264b8b45b8/412_-145- 412w, /images/content/5ca/cbe795a215e264b8b45b8/206_-72- 206w\" sizes=\"(min-width: 870px) 412px, (min-width: 400px) 38vw, 62%\"></source><img src=\"/images/content/5ca/cbe795a215e264b8b45b8/1946-687-\" alt=\"\" width=\"1946\" height=\"687\" data-content-img-id=\"5cacbe795a215e264b8b45b8\"></picture></p>\r\n<p class=\"FirstParagraph\">The output will look like this:</p>\r\n<p class=\"FirstParagraph\"><picture class=\"aligncenter med\"><source srcset=\"/images/content/5ca/cbeef9c658aef7e8b4584/742_-105- 742w, /images/content/5ca/cbeef9c658aef7e8b4584/412_-58- 412w, /images/content/5ca/cbeef9c658aef7e8b4584/206_-29- 206w\" sizes=\"(min-width: 870px) 412px, (min-width: 400px) 38vw, 62%\"></source><img src=\"/images/content/5ca/cbeef9c658aef7e8b4584/1946-277-\" alt=\"\" width=\"1946\" height=\"277\" data-content-img-id=\"5cacbeef9c658aef7e8b4584\"></picture></p>\r\n<p>Now that I have identified the different operating systems, I can either <a href=\"https://www.veeam.com/blog/how-to-convert-physical-machine-hyper-v-virtual-machine-disk2vhd.html\" target=\"_blank\">P2V</a> the machines or perhaps build new virtual machines in your hypervisor of choice. That could be done with PowerShell but is outside of the scope of this article, so we'll assume you've got that handled.</p>\r\n<h2>Deploying updates</h2>\r\n<p>Once you've got your test systems defined, you'll need to deploy patches. But first, which patches should be deployed? There are a couple of ways to do this that are outside of the scope of this article, such as looking at an existing WSUS server or using the <a href=\"https://www.powershellgallery.com/packages/LatestUpdate/1.0.1.15/Content/Public%5CGet-LatestUpdate.ps1\" target=\"_blank\">Get-LatestUpdate PowerShell script</a>, but I'll leave that to you.</p>\r\n<p>To deploy patches, one way to make that happen with PowerShell is to use a prebuilt community module called PSWindowsUpdate that handles the vast majority of tasks you'll have to deal with. You can install this module using Install-Module PSWindowsUpdate.</p>\r\n<p>The PSWindowsUpdate module requires RPC connectivity to each remote system that is sometimes blocked by default on Windows firewalls. You can open this with a GPO or similar system management tool, but since we're in PowerShell, we might as well go ahead and do that too. You'll need to run this command on each remote system you intend to patch.</p>\r\n<p><picture class=\"aligncenter med\"><source srcset=\"/images/content/5ca/cbf797b4374065b8b4589/742_-83- 742w, /images/content/5ca/cbf797b4374065b8b4589/412_-46- 412w, /images/content/5ca/cbf797b4374065b8b4589/206_-23- 206w\" sizes=\"(min-width: 870px) 412px, (min-width: 400px) 38vw, 62%\"></source><img src=\"/images/content/5ca/cbf797b4374065b8b4589/1946-218-\" alt=\"\" width=\"1946\" height=\"218\" data-content-img-id=\"5cacbf797b4374065b8b4589\"></picture></p>\r\n<p>To ensure the PSWindowsUpdate tool can access a remote system, I use a simple command like Get-WUHistory to see if it returns an error. If it returns patch history, you're good to go!</p>\r\n<p>We can now deploy our patches. For this article, I've found that I need to test patch KB4091664. I can deploy this patch to all of my test groups by first copying the module to each system and then running the Install-WindowsUpdate against each system specifying the KB I'd like to install and even scheduling the reboot for two hours from the time the patch is deployed.</p>\r\n<p><picture class=\"aligncenter med\"><source srcset=\"/images/content/5ca/cbfc07b437465068b456c/742_-306- 742w, /images/content/5ca/cbfc07b437465068b456c/412_-170- 412w, /images/content/5ca/cbfc07b437465068b456c/206_-85- 206w\" sizes=\"(min-width: 870px) 412px, (min-width: 400px) 38vw, 62%\"></source><img src=\"/images/content/5ca/cbfc07b437465068b456c/1946-804-\" alt=\"\" width=\"1946\" height=\"804\" data-content-img-id=\"5cacbfc07b437465068b456c\"></picture></p>\r\n<p>This will start the patch installation on each computer. To monitor progress, we can use the Get-WUHistory command. Below you'll see an example output where one of my machines has started the installation.</p>\r\n<p><picture class=\"aligncenter med\"><source srcset=\"/images/content/5ca/cc00d9c658a5b178b4582/742_-150- 742w, /images/content/5ca/cc00d9c658a5b178b4582/412_-83- 412w, /images/content/5ca/cc00d9c658a5b178b4582/206_-41- 206w\" sizes=\"(min-width: 870px) 412px, (min-width: 400px) 38vw, 62%\"></source><img src=\"/images/content/5ca/cc00d9c658a5b178b4582/1946-394-\" alt=\"\" width=\"1946\" height=\"394\" data-content-img-id=\"5cacc00d9c658a5b178b4582\"></picture></p>\r\n<h2>Wrap up</h2>\r\n<p class=\"FirstParagraph\">Testing patches before production is a necessary task but can be prone to error. Using a commercial tool will work, but if you need a simple solution to get the job done and are low on funds, PowerShell is a great way to ensure your systems don't go belly up come time to deploy patches to production.</p>\n","docType":"article","guid":"articles_633fa441c20c5c92b72f242edc88d56f","lastModified":"2019-04-11T12:41:00.000Z","published":"2019-04-11T12:41:00.000Z","structuredData":null,"subtitle":"PowerShell allows you to plan your deployment strategy for Microsoft's Patch Tuesday.","template":"legacy","title":"Developing a Patch Rollout Plan With PowerShell","type":"article","author":{"avatar":null,"bio":"Adam Bertram is a 20-year veteran of IT and experienced online business professional. He's an entrepreneur, IT influencer, Microsoft MVP, blogger, trainer and content marketing writer for multiple technology companies. Adam is also the founder of the popular IT career development platform TechSnips. Catch up on Adam's articles at adamtheautomator.com, connect on LinkedIn, or follow him on Twitter at @adbertram or the TechSnips Twitter account at @techsnips_io.","name":"Adam Bertram","image":null,"slug":null,"social":{"facebook":"","linkedin":"https://www.linkedin.com/in/adambertram/","twitter":"https://twitter.com/adbertram","website":"https://www.adamtheautomator.com/"},"status":"enabled","title":null,"type":"Contributing Writer","user":{"imagePath":"https://staging.business.com/images/undefined","profile":{"company":"eGain Communications","jobTitle":"Product Management Analyst","website":""}}},"breadcrumbs":null,"channels":{"primary":{"name":"Technology","slug":"technology"},"sub":{"name":"Technology Solutions","slug":"technology-solutions"}},"meta":{"robots":"index, follow","description":"Using PowerShell, we can develop a patch deployment strategy, and automate the process with little more than some sweat equity and time.","title":"Developing a Patch Rollout Plan With PowerShell - business.com"},"parsedContent":{"toc":[{"id":"prerequisites","title":"Prerequisites"},{"id":"discovering-the-environment-and-testing","title":"Discovering the environment and testing"},{"id":"deploying-updates","title":"Deploying updates"},{"id":"wrap-up","title":"Wrap up"}],"json":[{"component":"p","children":["Deploying patches is a task many IT administrators must endure every month. There are many commercial tools out there to ease this process, but some are expensive, bloated or overkill for simple patching that a smaller company may need."]},{"component":"p","children":["Using PowerShell, we can develop a patch deployment strategy and automate the process – just like the big tools – with little more than some sweat equity and time."]},{"component":"h2","props":{"id":"prerequisites"},"children":["Prerequisites"]},{"component":"p","children":["To ensure you can start with everything configured as needed, you'll need a few things. First, you'll need PowerShell. We'll be using Windows PowerShell 5.1. I am assuming you've already got PowerShell Remoting available on all of your clients, you've got appropriate rights to query and install patches on systems, you're in an Active Directory environment, and you've got the Remote Server Administration Tools package installed."]},{"component":"h2","props":{"id":"discovering-the-environment-and-testing"},"children":["Discovering the environment and testing"]},{"component":"p","children":["To ensure we test the most significant and most applicable sample of computers across our network, we first need to identify what systems are out there. Picking various configurations to test, such as Windows settings and software installed, across computers is an organizational choice, but typically, we'll need to find all of the operating systems we have to ensure patches don't break these systems when deployed to all systems."]},{"component":"p","children":["We can use PowerShell to query our Active Directory environment to return all groups of computers with a specific operating system. For example, the below code will return two test systems by operating systems across all of your Active Directory computers."]},{"component":"p","children":[{"component":"picture","props":{"className":"aligncenter med"},"children":[{"component":"source","props":{"srcSet":"/images/content/5ca/cbe795a215e264b8b45b8/742_-261- 742w, /images/content/5ca/cbe795a215e264b8b45b8/412_-145- 412w, /images/content/5ca/cbe795a215e264b8b45b8/206_-72- 206w","sizes":"(min-width: 870px) 412px, (min-width: 400px) 38vw, 62%"}},{"component":"img","props":{"src":"/images/content/5ca/cbe795a215e264b8b45b8/1946-687-","alt":"","width":"1946","height":"687","data-content-img-id":"5cacbe795a215e264b8b45b8"}}]}]},{"component":"p","props":{"className":"FirstParagraph"},"children":["The output will look like this:"]},{"component":"p","props":{"className":"FirstParagraph"},"children":[{"component":"picture","props":{"className":"aligncenter med"},"children":[{"component":"source","props":{"srcSet":"/images/content/5ca/cbeef9c658aef7e8b4584/742_-105- 742w, /images/content/5ca/cbeef9c658aef7e8b4584/412_-58- 412w, /images/content/5ca/cbeef9c658aef7e8b4584/206_-29- 206w","sizes":"(min-width: 870px) 412px, (min-width: 400px) 38vw, 62%"}},{"component":"img","props":{"src":"/images/content/5ca/cbeef9c658aef7e8b4584/1946-277-","alt":"","width":"1946","height":"277","data-content-img-id":"5cacbeef9c658aef7e8b4584"}}]}]},{"component":"p","children":["Now that I have identified the different operating systems, I can either ",{"component":"a","props":{"href":"https://www.veeam.com/blog/how-to-convert-physical-machine-hyper-v-virtual-machine-disk2vhd.html","target":"_blank"},"children":["P2V"]}," the machines or perhaps build new virtual machines in your hypervisor of choice. That could be done with PowerShell but is outside of the scope of this article, so we'll assume you've got that handled."]},{"component":"h2","props":{"id":"deploying-updates"},"children":["Deploying updates"]},{"component":"p","children":["Once you've got your test systems defined, you'll need to deploy patches. But first, which patches should be deployed? There are a couple of ways to do this that are outside of the scope of this article, such as looking at an existing WSUS server or using the ",{"component":"a","props":{"href":"https://www.powershellgallery.com/packages/LatestUpdate/1.0.1.15/Content/Public%5CGet-LatestUpdate.ps1","target":"_blank"},"children":["Get-LatestUpdate PowerShell script"]},", but I'll leave that to you."]},{"component":"p","children":["To deploy patches, one way to make that happen with PowerShell is to use a prebuilt community module called PSWindowsUpdate that handles the vast majority of tasks you'll have to deal with. You can install this module using Install-Module PSWindowsUpdate."]},{"component":"p","children":["The PSWindowsUpdate module requires RPC connectivity to each remote system that is sometimes blocked by default on Windows firewalls. You can open this with a GPO or similar system management tool, but since we're in PowerShell, we might as well go ahead and do that too. You'll need to run this command on each remote system you intend to patch."]},{"component":"p","children":[{"component":"picture","props":{"className":"aligncenter med"},"children":[{"component":"source","props":{"srcSet":"/images/content/5ca/cbf797b4374065b8b4589/742_-83- 742w, /images/content/5ca/cbf797b4374065b8b4589/412_-46- 412w, /images/content/5ca/cbf797b4374065b8b4589/206_-23- 206w","sizes":"(min-width: 870px) 412px, (min-width: 400px) 38vw, 62%"}},{"component":"img","props":{"src":"/images/content/5ca/cbf797b4374065b8b4589/1946-218-","alt":"","width":"1946","height":"218","data-content-img-id":"5cacbf797b4374065b8b4589"}}]}]},{"component":"p","children":["To ensure the PSWindowsUpdate tool can access a remote system, I use a simple command like Get-WUHistory to see if it returns an error. If it returns patch history, you're good to go!"]},{"component":"p","children":["We can now deploy our patches. For this article, I've found that I need to test patch KB4091664. I can deploy this patch to all of my test groups by first copying the module to each system and then running the Install-WindowsUpdate against each system specifying the KB I'd like to install and even scheduling the reboot for two hours from the time the patch is deployed."]},{"component":"p","children":[{"component":"picture","props":{"className":"aligncenter med"},"children":[{"component":"source","props":{"srcSet":"/images/content/5ca/cbfc07b437465068b456c/742_-306- 742w, /images/content/5ca/cbfc07b437465068b456c/412_-170- 412w, /images/content/5ca/cbfc07b437465068b456c/206_-85- 206w","sizes":"(min-width: 870px) 412px, (min-width: 400px) 38vw, 62%"}},{"component":"img","props":{"src":"/images/content/5ca/cbfc07b437465068b456c/1946-804-","alt":"","width":"1946","height":"804","data-content-img-id":"5cacbfc07b437465068b456c"}}]}]},{"component":"p","children":["This will start the patch installation on each computer. To monitor progress, we can use the Get-WUHistory command. Below you'll see an example output where one of my machines has started the installation."]},{"component":"p","children":[{"component":"picture","props":{"className":"aligncenter med"},"children":[{"component":"source","props":{"srcSet":"/images/content/5ca/cc00d9c658a5b178b4582/742_-150- 742w, /images/content/5ca/cc00d9c658a5b178b4582/412_-83- 412w, /images/content/5ca/cc00d9c658a5b178b4582/206_-41- 206w","sizes":"(min-width: 870px) 412px, (min-width: 400px) 38vw, 62%"}},{"component":"img","props":{"src":"/images/content/5ca/cc00d9c658a5b178b4582/1946-394-","alt":"","width":"1946","height":"394","data-content-img-id":"5cacc00d9c658a5b178b4582"}}]}]},{"component":"h2","props":{"id":"wrap-up"},"children":["Wrap up"]},{"component":"p","props":{"className":"FirstParagraph"},"children":["Testing patches before production is a necessary task but can be prone to error. Using a commercial tool will work, but if you need a simple solution to get the job done and are low on funds, PowerShell is a great way to ensure your systems don't go belly up come time to deploy patches to production."]}]},"resource":null,"sponsorship":null,"thumbnail":{"path":"https://staging.business.com/images/content/5ca/cbe085a215e4d598b458f/1500-0-","caption":"dotshock/Shutterstock","isBlurred":true},"bestPicks":null},"related":{"relatedArticles":[{"title":"PowerShell: Everything You Need to Know","canonical":"https://www.business.com/articles/powershell-everything-you-need-to-know/","slug":"powershell-everything-you-need-to-know","thumbnail":"https://www.business.com/images/content/5b8/998581039eb8f738b457b/1500-0-","dek":"What you need to know to unlock Microsoft PowerShell's full capabilities.","lastModified":"2018-09-05T17:00:00Z","published":"2018-09-05T17:00:00Z","sponsored":false},{"title":"Technology Should Enhance Communication Skills","canonical":"https://www.business.com/articles/technology-should-enhance-communication-skills/","slug":"technology-should-enhance-communication-skills","thumbnail":"https://www.business.com/images/content/5d3/2017f7b4374507f8b4567/1500-0-","dek":"The use of technology shouldn't strip away our communication skills.","lastModified":"2019-07-22T17:00:00Z","published":"2019-07-22T17:00:00Z","sponsored":false},{"title":"Staying On Track: Tips, Processes and Software to Keep Your Team Efficient","canonical":"https://www.business.com/articles/software-tools-tips-for-team-efficiency/","slug":"software-tools-tips-for-team-efficiency","thumbnail":"https://www.business.com/images/content/5ad/8ac6e1039eb78628b45a9/1500-0-","dek":"When your team needs to stay on track, there's a lot you can do to help them get there.","lastModified":"2018-04-19T14:35:00Z","published":"2018-04-19T14:35:00Z","sponsored":false},{"title":"Why Employee Monitoring Software Is Useful for Both Remote Work and the Office","canonical":"https://www.business.com/articles/employee-monitoring-software-in-office/","slug":"employee-monitoring-software-in-office","thumbnail":"https://www.business.com/images/content/5f3/18bfe9c658a1d778b4567/1500-0-","dek":"Many businesses now think employee monitoring software is only useful for remote work. However, this software is a great aid in the office as well. Here are the benefits as well as concerns.","lastModified":"2020-08-11T17:41:00Z","published":"2020-08-11T17:41:00Z","sponsored":false},{"title":"An Unexpected Benefit of a Digital Workplace","canonical":"https://www.business.com/articles/benefits-of-a-digital-workplace/","slug":"benefits-of-a-digital-workplace","thumbnail":"https://www.business.com/images/content/5d1/4c3125a215e8f688b4567/1500-0-","dek":"Going digital can have more benefits than you might expect.","lastModified":"2019-06-28T13:00:00Z","published":"2019-06-28T13:00:00Z","sponsored":false},{"title":"Should You Hire a Software Development Company for Your Project?","canonical":"https://www.business.com/articles/how-to-hire-a-software-developer/","slug":"how-to-hire-a-software-developer","thumbnail":"https://www.business.com/images/content/5dd/572ed5a215e81188b4570/1500-0-","dek":"In this era of technology, the demand for software development firms is on a constant rise. Choosing the best software development company is really a daunting task. This post helps you to know why you should a software development firm for your project","lastModified":"2019-11-21T23:00:00Z","published":"2019-11-21T23:00:00Z","sponsored":false},{"title":"How to Block Websites From Employee Use","canonical":"https://www.business.com/articles/how-to-block-websites/","slug":"how-to-block-websites","thumbnail":"https://www.business.com/images/content/5e7/a4ec09c658a28498b4569/1500-0-","dek":"Thinking about blocking inappropriate websites from employees? Here's how.","lastModified":"2020-03-24T18:14:00Z","published":"2019-03-07T13:30:00Z","sponsored":false},{"title":"How EMR and Practice Management Solutions Can Combat Healthcare Burnout","canonical":"https://www.business.com/articles/emr-practice-management-physician-burnout/","slug":"emr-practice-management-physician-burnout","thumbnail":"https://www.business.com/images/content/5da/a4e397b4374377a8b4573/1500-0-","dek":"Healthcare IT products like electronic medical records can reduce healthcare burnout.","lastModified":"2019-10-24T12:15:00Z","published":"2019-10-24T12:15:00Z","sponsored":false},{"title":"How to Hire for Your Business","canonical":"https://www.business.com/articles/how-to-staff-business/","slug":"how-to-staff-business","thumbnail":"https://www.business.com/images/content/5ea/9c8bb9c658aee018b456c/1500-0-","dek":"Sterling Staffing Solutions CEO Stephen Carter shares his tips on staffing your business.","lastModified":"2020-07-31T15:00:00Z","published":"2018-08-16T12:00:00Z","sponsored":false},{"title":"What Qualities Should You Look for in a Software Engineer?","canonical":"https://www.business.com/articles/software-engineer-qualities/","slug":"software-engineer-qualities","thumbnail":"https://www.business.com/images/content/5f3/56a585a215e0c3e8b4567/1500-0-","dek":"Learn more about the ideal qualities to look for in a software engineer.","lastModified":"2020-08-13T17:11:00Z","published":"2020-08-13T17:11:00Z","sponsored":false},{"title":"How to Use Technology to Improve Office Productivity","canonical":"https://www.business.com/articles/how-to-use-technology-to-improve-office-productivity/","slug":"how-to-use-technology-to-improve-office-productivity","thumbnail":"https://www.business.com/images/content/5dc/85f0d9c658a6d628b4567/1500-0-","dek":"Supercharge your office productivity by enlisting the latest gadgets and mastering ongoing digital trends.","lastModified":"2019-11-10T19:00:00Z","published":"2019-11-10T19:00:00Z","sponsored":false},{"title":"How Small Businesses Can Compete By Leveraging Data Insights","canonical":"https://www.business.com/articles/data-insight-for-small-business/","slug":"data-insight-for-small-business","thumbnail":"https://www.business.com/images/content/5dd/569177b4374ee0e8b4571/1500-0-","dek":"Many organizations still struggle to extract insight from their data. As a smaller business, you have a big advantage, but you must be careful to know exactly what type of insight will help your business to grow.","lastModified":"2019-11-21T19:00:00Z","published":"2019-11-21T19:00:00Z","sponsored":false}],"relatedReviews":[{"doc_type":"category","thumbnail":"https://staging.business.com/images/rz/5df908cc5a215e8c4a8b4568/conferencecall_Antonio_Diaz_Getty.jpg","canonical":"https://staging.business.com/categories/best-conference-call-services/","title":"The Best Conference Call Services of 2021","dek":"Which conference call service is right for your business in 2021? We review the top-rated services.","slug":"best-conference-call-services","lastModified":"2021-03-17T18:17:00Z"},{"doc_type":"category","thumbnail":"https://staging.business.com/images/rz/5df3d8695a215e58428b4570/POS_GETTY_DERO2084.jpg","canonical":"https://staging.business.com/categories/best-pos-systems/","title":"The Best POS Systems of 2021","dek":"Before you choose a POS system, check out our reviews of the best picks for 2021. ","slug":"best-pos-systems","lastModified":"2021-03-17T17:33:00Z"},{"doc_type":"category","thumbnail":"https://staging.business.com/images/rz/5e00d4787b43745d6a8b456e/Laptop_undrey_getty.jpg","canonical":"https://staging.business.com/categories/employee-monitoring-software/","title":"The Best Employee Monitoring Software of 2021","dek":"We've narrowed down the best employee monitoring software for businesses. Check out our best picks and reviews.","slug":"employee-monitoring-software","lastModified":"2021-03-05T15:40:00Z"}],"relatedSponsoredArticles":null}},"pageContext":{"displayModified":"2019-04-11T12:41:00.000Z","template":"legacy","title":"Developing a Patch Rollout Plan With PowerShell","meta":{"robots":"index, follow"},"docType":"articles","slug":"patch-rollout-plan-powershell","canonical":"https://staging.business.com/articles/patch-rollout-plan-powershell/","skipTOC":false}},"staticQueryHashes":[]}