<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>PowerShell Script for Exporting a virtual machine</title><link>http://blogs.msdn.com/b/virtual_pc_guy/archive/2012/02/08/powershell-script-for-exporting-a-virtual-machine.aspx</link><description>I need to automate the process of exporting a virtual machine recently &amp;ndash; and when I checked around I found that while there are a number of sample scripts out there that show you how to do this (some even on this blog) they are all written in VBScript</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: PowerShell Script for Exporting a virtual machine</title><link>http://blogs.msdn.com/b/virtual_pc_guy/archive/2012/02/08/powershell-script-for-exporting-a-virtual-machine.aspx#10409255</link><pubDate>Mon, 08 Apr 2013 07:07:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10409255</guid><dc:creator>Prasad</dc:creator><description>&lt;p&gt;Hi &lt;/p&gt;
&lt;p&gt;Can you please suggest that how to use above scripts manually :(&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10409255" width="1" height="1"&gt;</description></item><item><title>re: PowerShell Script for Exporting a virtual machine</title><link>http://blogs.msdn.com/b/virtual_pc_guy/archive/2012/02/08/powershell-script-for-exporting-a-virtual-machine.aspx#10289141</link><pubDate>Thu, 29 Mar 2012 21:37:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10289141</guid><dc:creator>Wesley</dc:creator><description>&lt;p&gt;Hi Ben, I am using the following script. &amp;nbsp;This can be executed through task manager by the runas command prompt: powershell.exe -noexit &amp;lt;Path to .ps1&amp;gt;&lt;/p&gt;
&lt;p&gt;•	Shutdown VM (Gracefully)&lt;/p&gt;
&lt;p&gt;•	Export VM to a network share&lt;/p&gt;
&lt;p&gt;•	Copy from a network share to the local drive on HyperV Host&lt;/p&gt;
&lt;p&gt;•	Import VM into HyperV Host&lt;/p&gt;
&lt;p&gt;•	Start imported VM&lt;/p&gt;
&lt;p&gt;Following is the code to make this happen. &amp;nbsp;Note that there are 2 &amp;nbsp;“VMName” folders, this is done so the first is a dummy folder that allows RoboCopy to copy all the contents necessary for import. &amp;nbsp;We must create the VMName folder previous to executing these for the first time, following the first time it will not be an issue.&lt;/p&gt;
&lt;p&gt;Get-VM -vm VMName | invoke-vmshutdown -force&lt;/p&gt;
&lt;p&gt;Export-VM -VM VMName -Path &amp;quot;\\ShareName\VMName&amp;quot; -CopyState -Wait &lt;/p&gt;
&lt;p&gt;robocopy &amp;quot;\\ShareName\VMName&amp;quot; &amp;quot;LocalDriveLocation&amp;quot; /E&lt;/p&gt;
&lt;p&gt;Import-VM -Path &amp;quot;PathOfImport&amp;quot; -Server HyperVServerImportedOn&lt;/p&gt;
&lt;p&gt;Start-VM -vm VMName&lt;/p&gt;
&lt;p&gt;I hope this helps someone else that needs to do the same. &amp;nbsp;We need to export, copy, then import, then start so we know that there is a working backup of the server.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10289141" width="1" height="1"&gt;</description></item><item><title>re: PowerShell Script for Exporting a virtual machine</title><link>http://blogs.msdn.com/b/virtual_pc_guy/archive/2012/02/08/powershell-script-for-exporting-a-virtual-machine.aspx#10274252</link><pubDate>Wed, 29 Feb 2012 09:16:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10274252</guid><dc:creator>David Vella</dc:creator><description>&lt;p&gt;Hi Ben,&lt;/p&gt;
&lt;p&gt;A quick note .. we just released a free PowerShell script to automate export of Hyper-V VMs. It&amp;#39;s quite an extensive job-based script.&lt;/p&gt;
&lt;p&gt;We have a download at &lt;a rel="nofollow" target="_new" href="http://www.altaro.com/blog/free-download-powershell-script-for-hyper-v-export/"&gt;www.altaro.com/.../free-download-powershell-script-for-hyper-v-export&lt;/a&gt;.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10274252" width="1" height="1"&gt;</description></item><item><title>re: PowerShell Script for Exporting a virtual machine</title><link>http://blogs.msdn.com/b/virtual_pc_guy/archive/2012/02/08/powershell-script-for-exporting-a-virtual-machine.aspx#10271018</link><pubDate>Wed, 22 Feb 2012 12:26:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10271018</guid><dc:creator>Leo</dc:creator><description>&lt;p&gt;i just tried your script 5 minutes ago and it didn&amp;#39;t work. FYI, I&amp;#39;m not a programmer but I&amp;#39;ve been trying to find a way to clone my VMs. So please point out where I did wrong. Thanks&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10271018" width="1" height="1"&gt;</description></item></channel></rss>