{"id":69143,"date":"2005-08-18T13:54:00","date_gmt":"2005-08-18T13:54:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2005\/08\/18\/how-can-i-start-up-and-shut-down-a-virtual-server-session\/"},"modified":"2005-08-18T13:54:00","modified_gmt":"2005-08-18T13:54:00","slug":"how-can-i-start-up-and-shut-down-a-virtual-server-session","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/how-can-i-start-up-and-shut-down-a-virtual-server-session\/","title":{"rendered":"How Can I Start Up and Shut Down a Virtual Server Session?"},"content":{"rendered":"<p><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Question\" height=\"34\" alt=\"Hey, Scripting Guy! Question\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" width=\"34\" align=\"left\" border=\"0\"> \n<P>Hey, Scripting Guy! How can I start up and shut down a Virtual Server session?<BR><BR>&#8212; DW<\/P><IMG height=\"5\" alt=\"Spacer\" src=\"https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2019\/05\/spacer.gif\" width=\"5\" border=\"0\"><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Answer\" height=\"34\" alt=\"Hey, Scripting Guy! Answer\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" width=\"34\" align=\"left\" border=\"0\"><A href=\"http:\/\/go.microsoft.com\/fwlink\/?linkid=68779&amp;clcid=0x409\"><IMG class=\"farGraphic\" title=\"Script Center\" height=\"288\" alt=\"Script Center\" src=\"http:\/\/img.microsoft.com\/library\/media\/1033\/technet\/images\/scriptcenter\/ad.jpg\" width=\"120\" align=\"right\" border=\"0\"><\/A> \n<P>Hey, DW. One of the Scripting Guys once had a neighbor who used to say, over and over again, \u201cYou know, I think I should have a garage sale. I really should have a garage sale.\u201d This went on for a couple of years, until the guy finally <I>did<\/I> have a garage sale. And nobody came. Towards the end of the day someone finally dropped by, and by then the neighbor was so happy to have a customer that he pretty much gave everything away. A few months later he moved (although we don\u2019t know whether that\u2019s because the garage sale was such a disappointment or because he had one of the Scripting Guys as a neighbor).<\/P>\n<P>We can empathize with this ex-neighbor. A year or so ago the Scripting Guys posted a bunch of <A href=\"http:\/\/www.microsoft.com\/technet\/scriptcenter\/scripts\/vs\/default.mspx\"><B>Virtual Server scripts<\/B><\/A> in the Script Repository, assuming all the while that we\u2019d soon be inundated with questions about scripting Virtual Server. And then nobody came. We know people downloaded the scripts, but nobody ever asked us any questions about scripting Virtual Server. We couldn\u2019t help but feel a little disappointed.<\/P>\n<P>Ah, but then we got your question, and we\u2019re so happy to have a Virtual Server scripting customer that we\u2019re going to pretty much <I>give<\/I> these scripts away. You want to use a script to start a virtual machine? Well then why didn\u2019t you say so:<\/P><PRE class=\"codeSample\">Set objVS = CreateObject(&#8220;VirtualServer.Application&#8221;)\nSet objVM = objVS.FindVirtualMachine(&#8220;Windows 2000 Server&#8221;)\nobjVM.Startup()\n<\/PRE>\n<P>Yes, just three lines of code. We begin by creating an instance of the <B>VirtualServer.Application<\/B> object. We then call the <B>FindVirtualMachine<\/B> method, passing as a single parameter the name of the machine we want to start (Windows 2000 Server). After that we simply call the <B>Startup()<\/B> method, and the virtual machine will begin loading. It\u2019s that simple.<\/P>\n<P>It\u2019s equally simple to shut down a virtual machine:<\/P><PRE class=\"codeSample\">Set objVS = CreateObject(&#8220;VirtualServer.Application&#8221;)\nSet objVM = objVS.FindVirtualMachine(&#8220;Windows 2000 Server&#8221;)\nobjVM.Turnoff()\n<\/PRE>\n<P>Yes, it <I>is<\/I> identical to the startup script, except for one thing: this time we call the <B>Turnoff()<\/B> method in order to shut the machine down. <\/P>\n<P>If you find these scripts useful, you might want to take some time and browse through the <A href=\"http:\/\/www.microsoft.com\/technet\/scriptcenter\/scripts\/vs\/default.mspx\"><B>Virtual Server scripts<\/B><\/A> in the Script Repository. There\u2019s a lot to choose from, and our prices (free) are tough to beat. The Scripting Guys will <I>not<\/I> be undersold!<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey, Scripting Guy! How can I start up and shut down a Virtual Server session?&#8212; DW Hey, DW. One of the Scripting Guys once had a neighbor who used to say, over and over again, \u201cYou know, I think I should have a garage sale. I really should have a garage sale.\u201d This went on [&hellip;]<\/p>\n","protected":false},"author":595,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[3,130,5,328],"class_list":["post-69143","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-scripting-guy","tag-servers","tag-vbscript","tag-virtual-server"],"acf":[],"blog_post_summary":"<p>Hey, Scripting Guy! How can I start up and shut down a Virtual Server session?&#8212; DW Hey, DW. One of the Scripting Guys once had a neighbor who used to say, over and over again, \u201cYou know, I think I should have a garage sale. I really should have a garage sale.\u201d This went on [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/69143","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/595"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=69143"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/69143\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=69143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=69143"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=69143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}