{"id":12592,"date":"2012-05-28T10:00:00","date_gmt":"2012-05-28T09:00:00","guid":{"rendered":"https:\/\/aidanfinn.com\/?p=12592"},"modified":"2012-05-28T10:00:00","modified_gmt":"2012-05-28T09:00:00","slug":"create-a-windows-server-2012-hyper-v-cluster-using-powershell","status":"publish","type":"post","link":"https:\/\/aidanfinn.com\/?p=12592","title":{"rendered":"Create A Windows Server 2012 Hyper-V Cluster Using PowerShell"},"content":{"rendered":"<p><em>I&#8217;ve since <a href=\"https:\/\/aidanfinn.com\/?p=13821\" target=\"_blank\">posted<\/a> a more complete script for a Hyper-V cluster that&#8217;s using SMB 3.0 storage.<\/em><\/p>\n<p>I am creating and destroying Hyper-V clusters like crazy in the lab at the moment.\u00a0 And that means I need to script; I don\u2019t want to waste time repeating the same thing over and over in the GUI, wasting valuable time.\u00a0 Assuming your networking is completed (more to come on scripting that!) and your disk is provisioned\/formatted, then the following script will build a cluster for you:<\/p>\n<p><em>New-Cluster \u2013Name demo-hvc1 \u2013StaticAddress 192.168.1.61 \u2013Node demo-host1, demo-host2<\/em><\/p>\n<p><em>Get-ClusterResource | Where-Object {$_.OwnerGroup \u2013eq \u201cAvailable Storage\u201d}\u00a0 | Add-ClusterSharedVolume<\/em><\/p>\n<p><em>(Get-Cluster).SharedVolumeBlockCacheSizeInMB = 512<\/em><\/p>\n<p><em>Get-ClusterSharedVolume *\u00a0 |\u00a0 Set-ClusterParameter CSVEnabledBlockCache 1<\/em><\/p>\n<p><em>Get-ClusterSharedVolume\u00a0 | Stop-ClusterResource<\/em><\/p>\n<p><em>Get-ClusterSharedVolume | Start-ClusterResource<\/em><\/p>\n<p>What does the script do?<\/p>\n<ol>\n<li>It creates a new cluster called demo-hvc1 with an IP address of 192.168.1.61 using demo-host1 and demo-host2 as the nodes.<\/li>\n<li>It finds all available disk and converts it to CSV volumes.<\/li>\n<li>Then it configures CSV cache to use 512 MB RAM<\/li>\n<li>Every CSV is configured to use CSV cache<\/li>\n<li>The CSVs are stopped<\/li>\n<li>The CSVs are restarted so they can avail of CSV cache<\/li>\n<\/ol>\n<p>The script doesn\u2019t do a validation.\u00a0 My setup is pretty static so no validation is required.\u00a0 BTW, for the VMLimited fanboys out there who moan about time to deploy Hyper-V, my process (networking included) builds the cluster in probably around 30-40 seconds.<\/p>\n<div id=\"scid:0767317B-992E-4b12-91E0-4F059A8CECA8:e31f3d6a-22ef-4ce3-8340-0656a88322da\" class=\"wlWriterEditableSmartContent\" style=\"margin: 0px; display: inline; float: none; padding: 0px;\">Technorati Tags: <a rel=\"tag\" href=\"http:\/\/technorati.com\/tags\/Windows+Server+2012\">Windows Server 2012<\/a>,<a rel=\"tag\" href=\"http:\/\/technorati.com\/tags\/Hyper-V\">Hyper-V<\/a>,<a rel=\"tag\" href=\"http:\/\/technorati.com\/tags\/Failover+Clustering\">Failover Clustering<\/a>,<a rel=\"tag\" href=\"http:\/\/technorati.com\/tags\/PowerShell\">PowerShell<\/a>,<a rel=\"tag\" href=\"http:\/\/technorati.com\/tags\/Scripting\">Scripting<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve since posted a more complete script for a Hyper-V cluster that&#8217;s using SMB 3.0 storage. I am creating and destroying Hyper-V clusters like crazy in the lab at the moment.\u00a0 And that means I need to script; I don\u2019t want to waste time repeating the same thing over and over in the GUI, wasting &hellip; <a href=\"https:\/\/aidanfinn.com\/?p=12592\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Create A Windows Server 2012 Hyper-V Cluster Using PowerShell&#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":[63,181,87,189,118],"class_list":["post-12592","post","type-post","status-publish","format-standard","hentry","category-hyper-v","tag-failover-clustering","tag-hyper-v","tag-powershell","tag-scripting","tag-windows-server-2012"],"aioseo_notices":[],"jetpack_featured_media_url":"","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/posts\/12592","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=12592"}],"version-history":[{"count":0,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/posts\/12592\/revisions"}],"wp:attachment":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12592"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12592"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12592"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}