{"id":188,"date":"2009-08-11T19:38:31","date_gmt":"2009-08-12T02:38:31","guid":{"rendered":"http:\/\/infinitedisorder.com\/?p=188"},"modified":"2009-08-11T21:05:43","modified_gmt":"2009-08-12T04:05:43","slug":"create-snapshot-on-multiple-vmware-vsphere-virtual-machines","status":"publish","type":"post","link":"https:\/\/infinitedisorder.com\/?p=188","title":{"rendered":"Create snapshot on multiple VMWare vSphere ESX virtual machines"},"content":{"rendered":"<p>I wrote a simple script which creates a snapshot on multiple machines. This can also be used to delete snapshots on multiple machines. You&#8217;ll need vmware SDK for perl and an answer file with IPs separated by a carriage return  like:<br \/>\n192.168.1.100<br \/>\n192.168.1.101<\/p>\n<p>Then use this script:<br \/>\n#!\/bin\/bash<br \/>\nAPI_User=administrator<br \/>\nAPI_Password=INSERT_PASSWORD<br \/>\nsnapshotName=test<br \/>\nanswerFile=.\/answerFile.txt<br \/>\ndestinationFile=\/var\/www\/default\/htdocs\/SnapshotsCreated.txt<br \/>\ndate &gt;&gt; $destinationFile<br \/>\necho &#8221; &#8221; &gt;&gt; $destinationFile<br \/>\nfor machineIP in `cat $answerFile`<br \/>\ndo<br \/>\necho &#8221; &#8221; &gt;&gt; $destinationFile<br \/>\necho &#8220;##### &#8220;$machineIP&#8221; #####&#8221; &gt;&gt; $destinationFile<br \/>\n\/usr\/lib\/vmware-viperl\/apps\/vm\/snapshotmanager.pl &#8211;url https:\/\/myVirtcenter.myCompany.com\/sdk\/vimService &#8211;username $API_User &#8211;password $API_Password &#8211;IPaddress $machineIP &#8211;operation create &#8211;snapshotname $snapshotName &gt;&gt; $destinationFile<br \/>\necho &#8221; &#8221; &gt;&gt; $destinationFile<br \/>\ndate &gt;&gt; $destinationFile<br \/>\nexit 0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I wrote a simple script which creates a snapshot on multiple machines. This can also be used to delete snapshots on multiple machines. You&#8217;ll need vmware SDK for perl and an answer file with IPs separated by a carriage return like: 192.168.1.100 192.168.1.101 Then use this script: #!\/bin\/bash API_User=administrator API_Password=INSERT_PASSWORD snapshotName=test answerFile=.\/answerFile.txt destinationFile=\/var\/www\/default\/htdocs\/SnapshotsCreated.txt date &gt;&gt; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-188","post","type-post","status-publish","format-standard","hentry","category-virtualization"],"_links":{"self":[{"href":"https:\/\/infinitedisorder.com\/index.php?rest_route=\/wp\/v2\/posts\/188","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/infinitedisorder.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/infinitedisorder.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/infinitedisorder.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/infinitedisorder.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=188"}],"version-history":[{"count":8,"href":"https:\/\/infinitedisorder.com\/index.php?rest_route=\/wp\/v2\/posts\/188\/revisions"}],"predecessor-version":[{"id":196,"href":"https:\/\/infinitedisorder.com\/index.php?rest_route=\/wp\/v2\/posts\/188\/revisions\/196"}],"wp:attachment":[{"href":"https:\/\/infinitedisorder.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/infinitedisorder.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=188"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/infinitedisorder.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}