{"id":2039,"date":"2014-06-11T22:18:44","date_gmt":"2014-06-11T20:18:44","guid":{"rendered":"http:\/\/michlstechblog.info\/blog\/?p=2039"},"modified":"2014-06-12T13:18:29","modified_gmt":"2014-06-12T11:18:29","slug":"vmware-vsphere-create-a-linked-clone-with-powercli","status":"publish","type":"post","link":"https:\/\/michlstechblog.info\/blog\/vmware-vsphere-create-a-linked-clone-with-powercli\/","title":{"rendered":"VMware vSphere: Create a linked clone with Powercli"},"content":{"rendered":"<div class=\"twoclick_social_bookmarks_post_2039 social_share_privacy clearfix 1.6.4 locale-en_US sprite-en_US\"><\/div><div class=\"twoclick-js\"><script type=\"text\/javascript\">\/* <![CDATA[ *\/\njQuery(document).ready(function($){if($('.twoclick_social_bookmarks_post_2039')){$('.twoclick_social_bookmarks_post_2039').socialSharePrivacy({\"services\":{\"flattr\":{\"uid\":\"Michl\",\"status\":\"on\",\"the_title\":\"VMware%20vSphere%3A%20Create%20a%20linked%20clone%20with%20Powercli\",\"the_excerpt\":\"Hi%2C%0D%0A%0D%0Alinked%20clones%20have%20some%20advantages%3A%0D%0A%0D%0A%09New%20virtual%20machines%20are%20rapidly%20deployed.%20The%20initial%20task%20is%20only%20to%20reference%20to%20a%20snapshot%20of%20an%20existing%20virtual%20machine.%20No%20virtual%20disk%20file%28s%29%20will%20be%20copied%20at%20this%20time.%0D%0A%09They%20save%20disk%20space.%20Because%20only%20the%20space%20difference%20to%20the%20origin%20snapshot%20is%20allocated.%0D%0A%0D%0AI%20found%20no%20option%20in%20the%20vSphere%20respective%20the%20Webclient%20to%20create%20one%20...\",\"txt_info\":\"2 clicks for more data protection:\\r\\n\\r\\nOnly when you click here, the button will be come active and you can send your recommendation to Flattr. When activating, data are transmitted to third parties. \",\"perma_option\":\"off\"}},\"txt_help\":\"When you activate these fields by clicking, information to Flattr may be transferred abroad, and probably may also stored there.\",\"settings_perma\":\"Enable permanently and accept data transmission. \",\"info_link\":\"http:\\\/\\\/www.heise.de\\\/ct\\\/artikel\\\/2-Klicks-fuer-mehr-Datenschutz-1333879.html\",\"uri\":\"https:\\\/\\\/michlstechblog.info\\\/blog\\\/vmware-vsphere-create-a-linked-clone-with-powercli\\\/\",\"post_id\":2039,\"post_title_referrer_track\":\"VMware+vSphere%3A+Create+a+linked+clone+with+Powercli\",\"display_infobox\":\"on\"});}});\n\/* ]]> *\/<\/script><\/div><p>Hi,<\/p>\n<p>linked clones have some advantages:<\/p>\n<ul>\n<li>New virtual machines are rapidly deployed. The initial task is only to reference to a snapshot of an existing virtual machine. No virtual disk file(s) will be copied at this time.<\/li>\n<li>They save disk space. Because only the space difference to the origin snapshot is allocated.<\/li>\n<\/ul>\n<p>I found no option in the vSphere respective the Webclient to create one, but PowerCli provides this. Lets do it.<br \/>\nConnect to vCenter<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\nConnect-VIServer vcenter.subdomain.domain.local\r\n<\/pre>\n<p>Define the virtual machine which is the origin of the linked clone, and the Snapshotname on which the linked clone based.<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\n$sOriginVM=&quot;mastervm&quot;\r\n$sOriginVMSnapshotName=&quot;mastervm_linkedclone_snap&quot;\r\n<\/pre>\n<p><!--more--><br \/>\nName of the new virtual machine<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\n$sNewVMName=&quot;linkedclonevm&quot;\r\n<\/pre>\n<p>In which logical vSphere folder should the vm placed. In this example the same folder as origin VM.<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\n$oVCenterFolder=(Get-VM $sOriginVM).Folder\r\n<\/pre>\n<p>Create a snapshot of the source VM<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\n$oSnapShot=New-Snapshot -VM $sOriginVM -Name $sOriginVMSnapshotName -Description &quot;Snapshot for linked clones&quot; -Memory -Quiesce\r\n<\/pre>\n<p>Define the datastore where the linked clone will be stored<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\n$oESXDatastore=Get-Datastore -Name &quot;esxdatastore1&quot;\r\n<\/pre>\n<p>Create the linked clone. For Windows system also Customisation makes sence(New SID, New Computername) these parameters are the same like a &#8220;normal&#8221; clone.<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\n$oLinkedClone=New-VM -Name $sNewVMName -VM $sOriginVM -Location $oVCenterFolder  -Datastore $oESXDatastore -ResourcePool Resources -LinkedClone -ReferenceSnapshot $oSnapShot<\/pre>\n<p>Thats it. Start the VM<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\nStart-VM $oLinkedClone\r\n<\/pre>\n<p>Make some things in the VM and stop it<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\nStop-VM $oLinkedClone -Confirm:$false\r\n<\/pre>\n<p>Delete the linked clone and remove the snapshot at the origin VM<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\nRemove-VM -DeletePermanently $oLinkedClone -Confirm:$false\r\nRemove-Snapshot -Snapshot $oSnapShot -Confirm:$false\r\n<\/pre>\n<p>Michael<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi, linked clones have some advantages: New virtual machines are rapidly deployed. The initial task is only to reference to a snapshot of an existing virtual machine. No virtual disk file(s) will be copied at this time. They save disk space. Because only the space difference to the origin snapshot is allocated. I found no &hellip; <a href=\"https:\/\/michlstechblog.info\/blog\/vmware-vsphere-create-a-linked-clone-with-powercli\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">VMware vSphere: Create a linked clone with Powercli<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[457,496,283,14,110],"class_list":["post-2039","post","type-post","status-publish","format-standard","hentry","category-vmware","tag-esxi","tag-linked-clone","tag-virtual-machine","tag-vmware-2","tag-vsphere"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/2039","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/comments?post=2039"}],"version-history":[{"count":7,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/2039\/revisions"}],"predecessor-version":[{"id":2046,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/2039\/revisions\/2046"}],"wp:attachment":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/media?parent=2039"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/categories?post=2039"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/tags?post=2039"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}