Warning: Constant WP_TEMP_DIR already defined in /var/www/html/blogs/joe/wp-config.php on line 93

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902
{"id":510,"date":"2012-02-06T10:06:00","date_gmt":"2012-02-06T10:06:00","guid":{"rendered":"\/blogs\/joe\/post\/VirtualBox-Script-to-Batch-Save-and-Start-Multiple-Guests.aspx"},"modified":"2013-01-02T20:36:32","modified_gmt":"2013-01-03T04:36:32","slug":"virtualbox-script-to-batch-save-and-start-multiple-guests","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/joe\/virtualbox-script-to-batch-save-and-start-multiple-guests\/","title":{"rendered":"VirtualBox Script to Batch Save and Start Multiple Guests"},"content":{"rendered":"

\nI use Windows 7 as my laptop host OS and this limits me from using Hyper-V natively to handle VM guests.   <\/span>Yes, I could do the dual-boot thing, but I haven’t done it yet and I do like the simplicity of not having to switch host OS contexts.  <\/span>Windows 8 will, thankfully, be adding Hyper-V hosting support to the client, but in the meantime I’ve been using VirtualBox for my guest OS needs.<\/font><\/font>\n<\/p>\n

\nJonathan Kehayias blogged about it extensively in his “<\/font><\/font>Building a Completely Free Playground<\/u><\/font><\/a><\/font>” series – and once I moved to SQLskills I felt less skittish about running a product that happened to have the big “O” word listed prominently on the application toolbar header.<\/font><\/font>\n<\/p>\n

\nI actually use VirtualBox for a variety of purposes – not just for SQL Server test environments. For example, if I need to connect to an environment that has conflicting (or unique) remote connectivity requirements, rather than risk clobbering my host VPN settings, I provision a clean, isolated guest environment that I use for connectivity and configuration instead.<\/font><\/font>\n<\/p>\n

\nSometimes I’ll have a group of servers that I want to launch at the same time or I’ll want to put a group of them in a saved state at the same time (for example – when running a guest Failover Cluster).  <\/span>In one case I have six different guests that I want to save or start at (nearly) the same time and I don’t like having to right-click save on each one – especially since my guests will quickly think something is wrong and when I bring them back from a saved state, it takes a few seconds to get them de-frazzled.<\/font><\/font>\n<\/p>\n

\nBy the way – I’m using these scripts for test environments.  <\/span>These are test environments that if I lost them, I’d be annoyed – but not devastated.<\/font>  <\/font><\/span><\/font><\/em>\n<\/p>\n

\nRather than rely on the GUI, I created a BAT file to save the guests in a batch:<\/font><\/font>\n<\/p>\n

\ncd \/D "C:\\Program Files\\Oracle\\VirtualBox\\"<\/font><\/font>\n<\/p>\n

\nSTART \/b VBoxManage.exe  <\/span>controlvm "Node4_D2"  <\/span>savestate <\/font><\/font>\n<\/p>\n

\nSTART \/b VBoxManage.exe  <\/span>controlvm "Node3_D2"  <\/span>savestate <\/font><\/font>\n<\/p>\n

\nSTART \/b VBoxManage.exe  <\/span>controlvm "Node2_D1"  <\/span>savestate <\/font><\/font>\n<\/p>\n

\nSTART \/b VBoxManage.exe  <\/span>controlvm "Node1_D1"  <\/span>savestate <\/font><\/font>\n<\/p>\n

\nSTART \/b VBoxManage.exe  <\/span>controlvm "SAN_D1" savestate <\/font><\/font>\n<\/p>\n

\nSTART \/b VBoxManage.exe  <\/span>controlvm "Node_DC"  <\/span>savestate<\/font><\/font>\n<\/p>\n

\n<\/font><\/font>\n<\/p>\n

\nI use the START option so that I’m not waiting for the save operation in a serial fashion.  <\/span>I use the “\/b” so that six windows don’t pop up.  <\/span>As for the Virtualbox command syntax – it’s pretty straightforward – I call VBoxManage.exe with controlvm followed by the name of the VM and the option to save it (savestate).<\/font><\/font>\n<\/p>\n

\nAs for starting<\/em> them up from the saved state, I do stagger things a bit.  <\/span>I use startvm instead of controlvm, followed by the VM name and I don’t use the START keyword for anything I want to ensure is executed in order (I also use the TIMEOUT option to wait a few seconds before launching other VMs):<\/font><\/font>\n<\/p>\n

\ncd \/D "C:\\Program Files\\Oracle\\VirtualBox\\"<\/font><\/font>\n<\/p>\n

\nVBoxManage.exe startvm "Node_DC"<\/font>  <\/font><\/span><\/font>\n<\/p>\n

\nVBoxManage.exe startvm "SAN_D1" <\/font><\/font>\n<\/p>\n

\nTIMEOUT 10<\/font><\/font>\n<\/p>\n

\nSTART \/b VBoxManage.exe startvm "Node1_D1"<\/font>  <\/font><\/span><\/font>\n<\/p>\n

\nSTART \/b VBoxManage.exe startvm "Node2_D1"<\/font>  <\/font><\/span><\/font>\n<\/p>\n

\nSTART \/b VBoxManage.exe startvm "Node3_D2"<\/font>  <\/font><\/span><\/font>\n<\/p>\n

\nSTART \/b VBoxManage.exe startvm "Node4_D2"<\/font><\/font>\n<\/p>\n

\n<\/font><\/font>\n<\/p>\n

\nEven with these scripts I wouldn’t call this an orderly and synchronized save and start.  <\/span>A Windows guest cluster may sometimes catch on to something being amiss – but often it does not.  <\/span>Sometimes I’ll have to wait a few seconds for the nodes to start talking to each other again.<\/font><\/font>\n<\/p>\n

\nAnyhow – if you also use VirtualBox and have any tips you’d like to share when it comes to coordinating the guest launches, please post here as I’m definitely curious to learn about them.<\/font><\/font><\/p>\n","protected":false},"excerpt":{"rendered":"

I use Windows 7 as my laptop host OS and this limits me from using Hyper-V natively to handle VM guests.   Yes, I could do the dual-boot thing, but I haven’t done it yet and I do like the simplicity of not having to switch host OS contexts.  Windows 8 will, thankfully, be adding […]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27,35],"tags":[],"class_list":["post-510","post","type-post","status-publish","format-standard","hentry","category-off-topic","category-virtual-machines"],"yoast_head":"\nVirtualBox Script to Batch Save and Start Multiple Guests - Joe Sack<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/joe\/virtualbox-script-to-batch-save-and-start-multiple-guests\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"VirtualBox Script to Batch Save and Start Multiple Guests - Joe Sack\" \/>\n<meta property=\"og:description\" content=\"I use Windows 7 as my laptop host OS and this limits me from using Hyper-V natively to handle VM guests.   Yes, I could do the dual-boot thing, but I haven’t done it yet and I do like the simplicity of not having to switch host OS contexts.  Windows 8 will, thankfully, be adding […]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/joe\/virtualbox-script-to-batch-save-and-start-multiple-guests\/\" \/>\n<meta property=\"og:site_name\" content=\"Joe Sack\" \/>\n<meta property=\"article:published_time\" content=\"2012-02-06T10:06:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-01-03T04:36:32+00:00\" \/>\n<meta name=\"author\" content=\"Joseph Sack\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Joseph Sack\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/virtualbox-script-to-batch-save-and-start-multiple-guests\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/virtualbox-script-to-batch-save-and-start-multiple-guests\/\",\"name\":\"VirtualBox Script to Batch Save and Start Multiple Guests - Joe Sack\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/#website\"},\"datePublished\":\"2012-02-06T10:06:00+00:00\",\"dateModified\":\"2013-01-03T04:36:32+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/#\/schema\/person\/533eb0113a15fb5a6e8067a49e4ae648\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/virtualbox-script-to-batch-save-and-start-multiple-guests\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/joe\/virtualbox-script-to-batch-save-and-start-multiple-guests\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/virtualbox-script-to-batch-save-and-start-multiple-guests\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Off-Topic\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/category\/off-topic\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"VirtualBox Script to Batch Save and Start Multiple Guests\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/\",\"name\":\"Joe Sack\",\"description\":\"SQL Server Performance Tuning, High Availability and Disaster Recovery Blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/#\/schema\/person\/533eb0113a15fb5a6e8067a49e4ae648\",\"name\":\"Joseph Sack\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a4b39a7719a6bfff1add3ec00527810734579ee114d6d983e8e68f937b77be96?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/a4b39a7719a6bfff1add3ec00527810734579ee114d6d983e8e68f937b77be96?s=96&d=mm&r=g\",\"caption\":\"Joseph Sack\"},\"description\":\"Joe Sack is a Principal Consultant with SQLskills. He has worked as a SQL Server professional since 1997 and has supported and developed for SQL Server environments in financial services, IT consulting, manufacturing, retail and the real estate industry. Prior to joining SQLskills he worked at Microsoft as a Premier Field Engineer supporting very large enterprise customer environments. He was responsible for providing deep SQL Server advisory services, training, troubleshooting and ongoing solutions guidance. His areas of expertise include performance tuning, scalability, T-SQL development and high-availability. In 2006 Joe earned the \u201cMicrosoft Certified Master: SQL Server 2005\u201d certification and in 2008 he earned the \u201cMicrosoft Certified Master: SQL Server 2008\u201d certification. In 2009 he took over responsibility for the entire SQL Server Microsoft Certified Master program and held that post until 2011. He was given the SQL Server MVP award in 2013.\",\"sameAs\":[\"http:\/\/3.209.169.194\/blogs\/joe\",\"https:\/\/twitter.com\/https:\/\/twitter.com\/josephsack\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/author\/joe\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"VirtualBox Script to Batch Save and Start Multiple Guests - Joe Sack","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/joe\/virtualbox-script-to-batch-save-and-start-multiple-guests\/","og_locale":"en_US","og_type":"article","og_title":"VirtualBox Script to Batch Save and Start Multiple Guests - Joe Sack","og_description":"I use Windows 7 as my laptop host OS and this limits me from using Hyper-V natively to handle VM guests.   Yes, I could do the dual-boot thing, but I haven’t done it yet and I do like the simplicity of not having to switch host OS contexts.  Windows 8 will, thankfully, be adding […]","og_url":"https:\/\/www.sqlskills.com\/blogs\/joe\/virtualbox-script-to-batch-save-and-start-multiple-guests\/","og_site_name":"Joe Sack","article_published_time":"2012-02-06T10:06:00+00:00","article_modified_time":"2013-01-03T04:36:32+00:00","author":"Joseph Sack","twitter_misc":{"Written by":"Joseph Sack","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/joe\/virtualbox-script-to-batch-save-and-start-multiple-guests\/","url":"https:\/\/www.sqlskills.com\/blogs\/joe\/virtualbox-script-to-batch-save-and-start-multiple-guests\/","name":"VirtualBox Script to Batch Save and Start Multiple Guests - Joe Sack","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/joe\/#website"},"datePublished":"2012-02-06T10:06:00+00:00","dateModified":"2013-01-03T04:36:32+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/joe\/#\/schema\/person\/533eb0113a15fb5a6e8067a49e4ae648"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/joe\/virtualbox-script-to-batch-save-and-start-multiple-guests\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/joe\/virtualbox-script-to-batch-save-and-start-multiple-guests\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/joe\/virtualbox-script-to-batch-save-and-start-multiple-guests\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/joe\/"},{"@type":"ListItem","position":2,"name":"Off-Topic","item":"https:\/\/www.sqlskills.com\/blogs\/joe\/category\/off-topic\/"},{"@type":"ListItem","position":3,"name":"VirtualBox Script to Batch Save and Start Multiple Guests"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/joe\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/joe\/","name":"Joe Sack","description":"SQL Server Performance Tuning, High Availability and Disaster Recovery Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/joe\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/joe\/#\/schema\/person\/533eb0113a15fb5a6e8067a49e4ae648","name":"Joseph Sack","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/joe\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/a4b39a7719a6bfff1add3ec00527810734579ee114d6d983e8e68f937b77be96?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a4b39a7719a6bfff1add3ec00527810734579ee114d6d983e8e68f937b77be96?s=96&d=mm&r=g","caption":"Joseph Sack"},"description":"Joe Sack is a Principal Consultant with SQLskills. He has worked as a SQL Server professional since 1997 and has supported and developed for SQL Server environments in financial services, IT consulting, manufacturing, retail and the real estate industry. Prior to joining SQLskills he worked at Microsoft as a Premier Field Engineer supporting very large enterprise customer environments. He was responsible for providing deep SQL Server advisory services, training, troubleshooting and ongoing solutions guidance. His areas of expertise include performance tuning, scalability, T-SQL development and high-availability. In 2006 Joe earned the \u201cMicrosoft Certified Master: SQL Server 2005\u201d certification and in 2008 he earned the \u201cMicrosoft Certified Master: SQL Server 2008\u201d certification. In 2009 he took over responsibility for the entire SQL Server Microsoft Certified Master program and held that post until 2011. He was given the SQL Server MVP award in 2013.","sameAs":["http:\/\/3.209.169.194\/blogs\/joe","https:\/\/twitter.com\/https:\/\/twitter.com\/josephsack"],"url":"https:\/\/www.sqlskills.com\/blogs\/joe\/author\/joe\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/joe\/wp-json\/wp\/v2\/posts\/510","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/joe\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/joe\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/joe\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/joe\/wp-json\/wp\/v2\/comments?post=510"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/joe\/wp-json\/wp\/v2\/posts\/510\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/joe\/wp-json\/wp\/v2\/media?parent=510"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/joe\/wp-json\/wp\/v2\/categories?post=510"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/joe\/wp-json\/wp\/v2\/tags?post=510"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}