{"id":7251,"date":"2015-03-16T00:01:00","date_gmt":"2015-03-16T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2015\/03\/16\/updating-virtual-machines\/"},"modified":"2019-02-18T10:30:16","modified_gmt":"2019-02-18T17:30:16","slug":"updating-virtual-machines","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/updating-virtual-machines\/","title":{"rendered":"Updating Virtual Machines"},"content":{"rendered":"<p><b style=\"font-size:12px\">Summary<\/b><span style=\"font-size:12px\">: Microsoft Scripting Guy, Ed Wilson, talks about the problem of updating virtual machines.<\/span><\/p>\n<p>Microsoft Scripting Guy, Ed Wilson, is here. This afternoon I am sipping a nice cup of red berry tea. I also have a bowl of grapes and a bit of brie. The berry tea, grapes, and brie are a nice combination, and light enough that it makes a nice afternoon snack.<\/p>\n<p>One of the great things I love about Windows&nbsp;8.1 is that it has real Hyper-V built-in to it, and it has Windows PowerShell cmdlet support for managing those virtual machines. The performance is really good, and it means that I can create a virtual machine on my laptop that replicates virtual machines in production. It makes a great test environment.<\/p>\n<p>My test network is completely isolated and I use the internal switch so the virtual machines can talk to each other. This is perfect for most occasions. The problem comes when I want to update those virtual machines.<\/p>\n<p>Here is an overview of the scenario&#8230;<\/p>\n<p>I need to first change from the internal switch type to a network adapter that uses the Ethernet connection. Luckily, I can do this while the virtual machine runs. I open Hyper-V Manager, right-click the name of the virtual machine, and choose <b>Settings<\/b> from the action menu. I then look for <b>Network adapter<\/b> under the <b>Hardware<\/b> section. I change the network adapter (virtual switch) to use the Ethernet network adapter from my host machine. This is shown here:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-3-16-15-01.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-3-16-15-01.png\" alt=\"Image of menu\" title=\"Image of menu\" \/><\/a><\/p>\n<p>Now I need to go into the virtual machine and modify the network adapter settings. This means that I right-click the network adapter icon on the tool bar, I choose <b>Open Network and Sharing Center<\/b>, select <b>Change adapter settings<\/b>, find my network adapter in <b>Network Connections<\/b>, right-click the adapter, choose <b>Properties<\/b>, scroll down until I find Internet Protocol Version 4 (TCP\/IPv4), and again select <b>Properties<\/b>.<\/p>\n<p>Now I change from a static IP address to a dynamic-assigned IP address and DNS. This is shown here:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-3-16-15-02.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-3-16-15-02.png\" alt=\"Image of menu\" title=\"Image of menu\" \/><\/a><\/p>\n<p>Then I click <b>OK<\/b>, click Close, X, X&hellip;wait for things to freeze a couple times, open Windows PowerShell, type <b>IPConfig<\/b> and look to see if I have a new IP address. If I do, great! If not, I need to investigate <b>ipconfig\/renew<\/b>.<\/p>\n<p>If that doesn&rsquo;t work, I need to disable the network adapter, re-enable it, and type <b>ipconfig\/renew<\/b> again. If that doesn&rsquo;t work, I reboot the virtual machine. Usually that will work. Today, it looks like everything is going well, and that it works. I open Internet Explorer to verify that I have Internet connectivity. This also works.<\/p>\n<p>So I open <b>Control Panel<\/b>, <b>System and Security<\/b>, <b>Windows Update<\/b>, and <b>Check for Updates<\/b>, and again wait a while&#8230;<\/p>\n<p>As shown here, there are a few updates that I need to install:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-3-16-15-03.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/hsg-3-16-15-03.png\" alt=\"Image of menu\" title=\"Image of menu\" \/><\/a><\/p>\n<p>And now I wait for a while again. Hmmm&hellip;<\/p>\n<p>While I am waiting, I think I will go make a cup of tea. Back in a while&#8230;<\/p>\n<p>Well, that all took a while, and now I need to reboot the virtual machine. Then I have to reverse the process: change back to the virtual switch, go back into the network adapter, and configure a static IP address.<\/p>\n<p>So there is a description of the problem I face. When I have multiple virtual machines that I need to update, it takes a while. So, this becomes a great area for automation&mdash;and that is just what Sean will do tomorrow.<\/p>\n<p>Join me tomorrow when I have a guest article by Microsoft PowerShell MVP and Honorary Scripting Guy, Sean Kearney. He will talk about performing an offline update.<\/p>\n<p>I invite you to follow me 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 me at <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. Until then, peace.<\/p>\n<p><b>Ed Wilson, Microsoft Scripting Guy<\/b><span style=\"font-size:12px\">&nbsp;<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Microsoft Scripting Guy, Ed Wilson, talks about the problem of updating virtual machines. Microsoft Scripting Guy, Ed Wilson, is here. This afternoon I am sipping a nice cup of red berry tea. I also have a bowl of grapes and a bit of brie. The berry tea, grapes, and brie are a nice combination, [&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":[271,3,45],"class_list":["post-7251","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-hyper-v","tag-scripting-guy","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Microsoft Scripting Guy, Ed Wilson, talks about the problem of updating virtual machines. Microsoft Scripting Guy, Ed Wilson, is here. This afternoon I am sipping a nice cup of red berry tea. I also have a bowl of grapes and a bit of brie. The berry tea, grapes, and brie are a nice combination, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/7251","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=7251"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/7251\/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=7251"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=7251"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=7251"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}