{"id":7231,"date":"2015-03-17T00:01:00","date_gmt":"2015-03-17T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2015\/03\/17\/update-offline-virtual-machine-with-powershell-and-wsus-offline-update-part-1\/"},"modified":"2019-02-18T10:30:15","modified_gmt":"2019-02-18T17:30:15","slug":"update-offline-virtual-machine-with-powershell-and-wsus-offline-update-part-1","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/update-offline-virtual-machine-with-powershell-and-wsus-offline-update-part-1\/","title":{"rendered":"Update Offline Virtual Machine with PowerShell and WSUS Offline Update: Part 1"},"content":{"rendered":"<p><b style=\"font-size:12px\">Summary<\/b><span style=\"font-size:12px\">: Honorary Scripting Guy, Sean Kearney introduces a cool tool for updating virtual machines.<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Question\" \/>&nbsp;Hey, Scripting Guy! I have some virtual machines that are normally offline. They need to be updated on a regular basis, but these machines have no access to the Windows Server Update Services (WSUS) server. Is there an easy answer to this problem?<\/p>\n<p>&mdash;WT<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Answer\" \/>&nbsp;Hello WT,<\/p>\n<p>Honorary Scripting Guy, Sean Kearney, is here to show a little magic with Windows PowerShell and the Windows update system.<\/p>\n<p>Updating an offline virtual machine really isn&rsquo;t that difficult. Just power it up, wait for the updates to download from Microsoft or your central updating system, and&hellip;<\/p>\n<p>Oh, wait a minute. That doesn&rsquo;t cover all scenarios does it? What about virtual machines that never get attached to the production LAN? Or virtual machines that operate in a secure network structure, which is isolated from the Internet and the production update system for security reasons?<\/p>\n<p>Even if you have access to a centralized update system (such as WSUS), you&rsquo;ll still have to force a download of the updates.<\/p>\n<p>Then what if you had the option to inject the updates directly into the virtual machine&#8230;maybe a process that didn&rsquo;t even need network access? Would that not be an interesting option?<\/p>\n<p>That option is yours to have! There is a free tool that you can download from the Internet called WSUS Offline Update. It&rsquo;s a great tool that runs off donations from the community. It packages the automatic updates into a folder structure that you can burn to DVD or CD, store on portable USB media, or any other distribution solution your mind can imagine.<\/p>\n<p>By leveraging this solution and a little Windows PowerShell, we can provide an easy-to-automate solution to inject those updates into offline VHD files.<\/p>\n<p>First we need to download and configure WSUS Offline Update. This is quite simple to do. Go to the <a href=\"http:\/\/download.wsusoffline.net\/\" target=\"_blank\">WSUS Offline Update<\/a> website, click the <b>Download<\/b> button, and choose the link in the right pane. You will be downloading a single ZIP file that contains everything you&rsquo;ll need to implement this easy-to-use solution.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-3-17-15-1.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-3-17-15-1.png\" alt=\"Image of site\" title=\"Image of site\" \/><\/a><\/p>\n<p>After it is downloaded, unblock the ZIP archive. I have found that if you don&rsquo;t unblock ZIP archives it can actually affect the content, especially the MSI files within it.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-3-17-15-2.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-3-17-15-2.png\" alt=\"Image of menu\" title=\"Image of menu\" \/><\/a><\/p>\n<p>Extract that ZIP archive to your folder of choice by right-clicking the file and selecting <b>Extract All<\/b>.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-3-17-15-3.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-3-17-15-3.png\" alt=\"Image of menu\" title=\"Image of menu\" \/><\/a><\/p>\n<p>For our purposes today, I am going to place it at the root of drive C. It will automatically create a folder called <b>WSUSOffline<\/b>.&nbsp; Click the <b>Extract<\/b> button to complete the process.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-3-17-15-4.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-3-17-15-4.png\" alt=\"Image of menu\" title=\"Image of menu\" \/><\/a><\/p>\n<p>Now that you have extracted WSUS Offline Update, it&rsquo;s time to configure.&nbsp; This is actually very easy to do or to change afterwards. Navigate to the C:\\Wsusoffline folder and run the <b>UpdateGenerator.exe<\/b> application.<\/p>\n<p>We are going to target the following collections of updates:<\/p>\n<ul>\n<li>Windows 8.1 and Windows Server 2012 R2<\/li>\n<li>C++ Runtime Libraries and .NET Framework<\/li>\n<li>Microsoft Security Essentials<\/li>\n<li>Windows Defender definitions (for updating the antivirus while offline)<\/li>\n<\/ul>\n<p>We could also expand this collection into updates for Microsoft Office 2013, 2010, and 2007, but we&rsquo;ll focus on a simpler configuration at this time.<\/p>\n<p>We are also going to create a single folder that will act as the medium. The author targets a USB key, but in actuality, the folder can exist anywhere. It provides the updates in addition to all the executables needed to inject the updates.<\/p>\n<p>In the following image, note the configuration changes highlighted in red:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-3-17-15-5.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-3-17-15-5.png\" alt=\"Image of menu\" title=\"Image of menu\" \/><\/a><\/p>\n<p>Click the <b>Start<\/b> button to continue. You may be prompted to update your Trusted Root Certificates. Please do so if prompted.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-3-17-15-6.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-3-17-15-6.png\" alt=\"Image of message\" title=\"Image of message\" \/><\/a><\/p>\n<p>At this point, the system will begin downloading the updates into the <b>WSUSOffline<\/b> folder structure. Grab a nice mint tea and sit down. This will take a while&#8230;<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-3-17-15-7.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-3-17-15-7.png\" alt=\"Image of code\" title=\"Image of code\" \/><\/a><\/p>\n<p>Done with your tea? Maybe take in a Doctor Who episode while you were waiting? (I did!) When it&rsquo;s done, we can get to the fun stuff!<\/p>\n<p>WT, sorry but that is all for today. Please come back tomorrow for the rest of the story.<\/p>\n<p>We invite you to follow us on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\">Facebook<\/a>. If you have any questions, send email to <a href=\"mailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>. See you tomorrow.<\/p>\n<p><b>Sean Kearney<\/b>, Microsoft PowerShell MVP and Honorary Scripting Guy<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Honorary Scripting Guy, Sean Kearney introduces a cool tool for updating virtual machines. &nbsp;Hey, Scripting Guy! I have some virtual machines that are normally offline. They need to be updated on a regular basis, but these machines have no access to the Windows Server Update Services (WSUS) server. Is there an easy answer to [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[56,271,3,154,573,45,380],"class_list":["post-7231","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-guest-blogger","tag-hyper-v","tag-scripting-guy","tag-sean-kearney","tag-server-side-management","tag-windows-powershell","tag-windows-update"],"acf":[],"blog_post_summary":"<p>Summary: Honorary Scripting Guy, Sean Kearney introduces a cool tool for updating virtual machines. &nbsp;Hey, Scripting Guy! I have some virtual machines that are normally offline. They need to be updated on a regular basis, but these machines have no access to the Windows Server Update Services (WSUS) server. Is there an easy answer to [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/7231","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=7231"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/7231\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=7231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=7231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=7231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}