{"id":11942,"date":"2011-12-20T15:00:00","date_gmt":"2011-12-20T15:00:00","guid":{"rendered":"https:\/\/aidanfinn.com\/?p=11942"},"modified":"2011-12-20T15:00:00","modified_gmt":"2011-12-20T15:00:00","slug":"hyper-v-powershell-getting-the-host-on-the-network","status":"publish","type":"post","link":"https:\/\/aidanfinn.com\/?p=11942","title":{"rendered":"Hyper-V &#038; PowerShell \u2013 Getting The Host On The Network"},"content":{"rendered":"<p><em>Note: I\u2019d normally configure TCP-IP at this point but the cmdlets that I seem to need to use either are not working correctly or are very confusing \u2013 that\u2019s pre-beta software for you!&#160; I\u2019ll try to return to that topic at a later point if I find a solution.<\/em><\/p>\n<p>When you install Windows without some clever imaging solution, the machine comes up with some random (not completely) computer name.&#160; You can PowerShell this if you want:<\/p>\n<p><font style=\"background-color: #666666\">Rename-Computer MyNewComputerName \u2013restart<\/font><\/p>\n<p>In a previous blog post I mentioned that POSH (PowerShell) is great for scripting.&#160; You can put a whole load of these commands in a single PS1 file and run it.&#160; This cmdlet is an example of where you\u2019d need user input.&#160; In that case, the following embeds the prompt for a new computer name inside of the Rename-Computer cmdlet.&#160; When you run this, the embedded Read-Host cmdlet is run and provides the user input to the Rename-Computer cmdlet.<\/p>\n<p><font style=\"background-color: #666666\">Rename-Computer (Read-Host \u201cEnter a new computer name\u201d) \u2013restart<\/font><\/p>\n<p>Once that reboot is done, you can join a domain.&#160; The following cmdlet does just that.&#160; It will fire up a traditional Windows prompt for a user name and password to do the domain join.<\/p>\n<p><font style=\"background-color: #666666\">Add-Computer \u2013DomainName \u201cdemo.internal\u201d \u2013Restart<\/font><\/p>\n<p>Want some help and examples beyond what you can get from Get-Help?&#160; Try this:<\/p>\n<p><font style=\"background-color: #666666\">Get-Help Add-Computer \u2013Online<\/font><\/p>\n<p>That should fire up your web browser and bring you to an official MSFT web page for the cmdlet in question.&#160; A nice example you\u2019ll find for Add-Computer is that you can use the \u2013OUPath flag to specify a location to place the new computer object in your domain.&#160; I tend to have a special OU for Hyper-V hosts so that\u2019s where I\u2019d place the computer object.&#160; So instead of using the default computer object creation location (and probably forgetting to move the object to the correct one before the reboot), I can save some human effort by running:<\/p>\n<p><font style=\"background-color: #666666\">Add-Computer \u2013DomainName \u201cdemo.internal\u201d \u2013OUPath \u201cOU=Hyper-V, OU=Servers, OU=Company, DC=demo, DC=com\u201d \u2013Restart<\/font><\/p>\n<p>And that\u2019s your host named and in the domain, all ready to manage with SCVMM.<\/p>\n<div style=\"padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px\" id=\"scid:0767317B-992E-4b12-91E0-4F059A8CECA8:e9163c46-a0ca-4266-b4c4-e8360af2f294\" class=\"wlWriterEditableSmartContent\">Technorati Tags: <a href=\"http:\/\/technorati.com\/tags\/Hyper-V\" rel=\"tag\">Hyper-V<\/a>,<a href=\"http:\/\/technorati.com\/tags\/PowerShell\" rel=\"tag\">PowerShell<\/a>,<a href=\"http:\/\/technorati.com\/tags\/Scripting\" rel=\"tag\">Scripting<\/a>,<a href=\"http:\/\/technorati.com\/tags\/Windows+8\" rel=\"tag\">Windows 8<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Note: I\u2019d normally configure TCP-IP at this point but the cmdlets that I seem to need to use either are not working correctly or are very confusing \u2013 that\u2019s pre-beta software for you!&#160; I\u2019ll try to return to that topic at a later point if I find a solution. When you install Windows without some &hellip; <a href=\"https:\/\/aidanfinn.com\/?p=11942\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Hyper-V &#038; PowerShell \u2013 Getting The Host On The Network&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[20],"tags":[181,87,189,109],"class_list":["post-11942","post","type-post","status-publish","format-standard","hentry","category-hyper-v","tag-hyper-v","tag-powershell","tag-scripting","tag-windows-8"],"aioseo_notices":[],"jetpack_featured_media_url":"","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/posts\/11942","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11942"}],"version-history":[{"count":0,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/posts\/11942\/revisions"}],"wp:attachment":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11942"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11942"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11942"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}