{"id":283,"date":"2009-10-05T19:40:04","date_gmt":"2009-10-05T18:40:04","guid":{"rendered":"http:\/\/www.amikkelsen.com\/?p=283"},"modified":"2010-06-13T20:56:13","modified_gmt":"2010-06-13T19:56:13","slug":"powershell-add-host-to-cluster-and-license-it","status":"publish","type":"post","link":"https:\/\/www.amikkelsen.com\/?p=283","title":{"rendered":"Powershell &#8211; Add host to Cluster and license it."},"content":{"rendered":"<p><strong>This PowerShell script adds a host to a Cluster and licenses it.<\/strong><\/p>\n<pre><span style=\"color: #0000ff;\">\r\nAdd-PSSnapin VMware.VimAutomation.Core\r\nConnect-VIServer \"VC_server_name\" -User \"Administrator\" -Password \"password\"\r\nadd-vmhost \"esxhost\" -location (get-datacenter -name 'Datacenter' | \r\n   get-folder -name 'Folder' | get-cluster -name 'Cluster') -user \"root\" \r\n   -password \"password\" -force: $true\r\n$targethostMoRef = (get-VMHost $strHost\u00c2\u00a0 | get-view).MoRef\r\n$si = Get-View ServiceInstance\r\n$LicManRef=$si.Content.LicenseManager\r\n$LicManView=Get-View $LicManRef\r\n$licassman = Get-View $LicManView.LicenseAssignmentManager\r\n$licassman.UpdateAssignedLicense($targethostMoRef.value,\u00e2\u20ac\u009dYOUR LIC KEY\u00e2\u20ac\u009d,\r\n   \u00e2\u20ac\u009dvSphere4 Enterprise Plus (1-12 cores per CPU\u00e2\u20ac\u009d)\r\nDisconnect-VIServer -Confirm:$false\r\n<\/span><\/pre>\n<p>Download it <a href=\"http:\/\/www.amikkelsen.com\/?page_id=91\" target=\"_self\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This PowerShell script adds a host to a Cluster and licenses it. Add-PSSnapin VMware.VimAutomation.Core Connect-VIServer &#8220;VC_server_name&#8221; -User &#8220;Administrator&#8221; -Password &#8220;password&#8221; add-vmhost &#8220;esxhost&#8221; -location (get-datacenter -name &#8216;Datacenter&#8217; | get-folder -name &#8216;Folder&#8217; | get-cluster -name &#8216;Cluster&#8217;) -user &#8220;root&#8221; -password &#8220;password&#8221; -force: $true $targethostMoRef = (get-VMHost $strHost\u00c2\u00a0 | get-view).MoRef $si = Get-View ServiceInstance $LicManRef=$si.Content.LicenseManager $LicManView=Get-View $LicManRef $licassman =\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.amikkelsen.com\/?p=283\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[171,170,169,172,330,48],"class_list":["post-283","post","type-post","status-publish","format-standard","hentry","category-powershell","tag-automation","tag-cluster","tag-host","tag-license","tag-powershell","tag-script"],"_links":{"self":[{"href":"https:\/\/www.amikkelsen.com\/index.php?rest_route=\/wp\/v2\/posts\/283","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.amikkelsen.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.amikkelsen.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.amikkelsen.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.amikkelsen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=283"}],"version-history":[{"count":6,"href":"https:\/\/www.amikkelsen.com\/index.php?rest_route=\/wp\/v2\/posts\/283\/revisions"}],"predecessor-version":[{"id":285,"href":"https:\/\/www.amikkelsen.com\/index.php?rest_route=\/wp\/v2\/posts\/283\/revisions\/285"}],"wp:attachment":[{"href":"https:\/\/www.amikkelsen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.amikkelsen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=283"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.amikkelsen.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}