如何以PowerShell備份和匯出HyperV的虛擬機器
-
2012年2月20日 上午 03:19
請教各位先進!
目前客戶端已經有建置Windows Server 2008 R2的Hyper-V環境,應該要如何設定才能以PowerShell備份和匯出HyperV的虛擬機器做排程的備份呢?
感謝...
- 已編輯 DannyLee 2012年2月20日 上午 03:21
- 已移動 AChangeMicrosoft Contingent Staff, Owner 2012年2月20日 上午 08:13 About PowerShell (從:Windows Server 2008 專區)
所有回覆
-
2012年2月20日 上午 05:19
Hi
這邊有一個類似您需求的討論
不過,Hyper-V如果透過這種方式備份的話,是需要將VM關機的
http://ithelp.ithome.com.tw/question/10066737?tag=rt.rq
Best Regards, Daniel Liang
-
2012年2月20日 上午 08:16
感謝您的回覆~~
因為script太長了,請問有沒有單一指令的說明呢?
感恩...
-
2012年2月20日 上午 08:19
可以利用PowerShell management Library for Hyper-V來做。
以上說明若有錯誤請指教,謝謝。
http://www.dotblogs.com.tw/terrychuang/ -
2012年2月20日 上午 08:31
感謝回覆,我們會再研究看看,謝謝囉 ^^可以利用PowerShell management Library for Hyper-V來做。
以上說明若有錯誤請指教,謝謝。
http://www.dotblogs.com.tw/terrychuang/ -
2012年2月21日 上午 06:50
各位好!
我們在2008 R2上面安裝PowerShell Management Library for Hyper-V,出現下面的錯誤
Installing PowerShell module for HyperV
=============================================
Ensuring that .Net Framework 2 and Windows PowerShell are installed
Press [ctrl][c] to abort or
請按任意鍵繼續 . . .
It is safe to ignore any Error messages
部署映像服務與管理工具
版本: 6.1.7600.16385
映像版本: 6.1.7600.16385
錯誤: 0x800f080c
功能名稱 NetFx2-ServerCore 未知。
無法辨識 Windows 功能名稱。
請使用 /Get-Features 選項找出映像中的功能名稱,並重新嘗試命令。
在 C:\Windows\Logs\DISM\dism.log 中可找到 DISM 記錄檔
部署映像服務與管理工具
版本: 6.1.7600.16385
映像版本: 6.1.7600.16385
錯誤: 0x800f080c
功能名稱 MicrosoftWindowsPowerShell 未知。
無法辨識 Windows 功能名稱。
請使用 /Get-Features 選項找出映像中的功能名稱,並重新嘗試命令。
在 C:\Windows\Logs\DISM\dism.log 中可找到 DISM 記錄檔
About to create folder and copy Powershell module.
Press [ctrl][c] to abort or
請按任意鍵繼續 . . .
請問以上問題應該如何排除呢?感恩
-
2012年2月21日 上午 06:58安裝時,請使用管理者權限安裝喔
-
2012年2月21日 上午 07:46
安裝時,請使用管理者權限安裝喔
使用管理者權限安裝
Installing PowerShell module for HyperV
=============================================
Ensuring that .Net Framework 2 and Windows PowerShell are installed
Press [ctrl][c] to abort or
請按任意鍵繼續 . . .
It is safe to ignore any Error messages
部署映像服務與管理工具
版本: 6.1.7600.16385
映像版本: 6.1.7600.16385
錯誤: 0x800f080c
功能名稱 NetFx2-ServerCore 未知。
無法辨識 Windows 功能名稱。
請使用 /Get-Features 選項找出映像中的功能名稱,並重新嘗試命令。
在 C:\Windows\Logs\DISM\dism.log 中可找到 DISM 記錄檔
部署映像服務與管理工具
版本: 6.1.7600.16385
映像版本: 6.1.7600.16385
錯誤: 0x800f080c
功能名稱 MicrosoftWindowsPowerShell 未知。
無法辨識 Windows 功能名稱。
請使用 /Get-Features 選項找出映像中的功能名稱,並重新嘗試命令。
在 C:\Windows\Logs\DISM\dism.log 中可找到 DISM 記錄檔
About to create folder and copy Powershell module.
Press [ctrl][c] to abort or
請按任意鍵繼續 . . .
子目錄或檔案 C:\Program Files\modules\HyperV 已經存在。
C:\PsHyperV\install.cmd\..\HyperV\disk.ps1
C:\PsHyperV\install.cmd\..\HyperV\En-us.ps1
C:\PsHyperV\install.cmd\..\HyperV\Helper.ps1
C:\PsHyperV\install.cmd\..\HyperV\hyperv.format.ps1xml
C:\PsHyperV\install.cmd\..\HyperV\HyperV.psd1
C:\PsHyperV\install.cmd\..\HyperV\Maml-Helper.XML
C:\PsHyperV\install.cmd\..\HyperV\maml-vm.xml
C:\PsHyperV\install.cmd\..\HyperV\maml-vmconfig.xml
C:\PsHyperV\install.cmd\..\HyperV\maml-vmDisk.xml
C:\PsHyperV\install.cmd\..\HyperV\MAML-VMNetwork.XML
C:\PsHyperV\install.cmd\..\HyperV\MAML-VMSnapshot.XML
C:\PsHyperV\install.cmd\..\HyperV\menu.ps1
C:\PsHyperV\install.cmd\..\HyperV\Network.ps1
C:\PsHyperV\install.cmd\..\HyperV\SnapShot.ps1
C:\PsHyperV\install.cmd\..\HyperV\v1Compatability.ps1
C:\PsHyperV\install.cmd\..\HyperV\vm.ps1
C:\PsHyperV\install.cmd\..\HyperV\VMConfig.ps1
複製了 17 個檔案。
About to set registry entries for PowerShell script execution, module path and c
onsole settings
Press [ctrl][c] to abort or
請按任意鍵繼續 . . .
About to Launch the PowerShell for HyperV
Press [ctrl][c] to abort or
請按任意鍵繼續 . . .

請問這樣算是安裝成功了嗎?感恩
-
2012年2月21日 上午 08:49
安裝時,請使用管理者權限安裝喔
使用管理者權限安裝
Installing PowerShell module for HyperV
=============================================
Ensuring that .Net Framework 2 and Windows PowerShell are installed
Press [ctrl][c] to abort or
請按任意鍵繼續 . . .
It is safe to ignore any Error messages
部署映像服務與管理工具
版本: 6.1.7600.16385
映像版本: 6.1.7600.16385
錯誤: 0x800f080c
功能名稱 NetFx2-ServerCore 未知。
無法辨識 Windows 功能名稱。
請使用 /Get-Features 選項找出映像中的功能名稱,並重新嘗試命令。
在 C:\Windows\Logs\DISM\dism.log 中可找到 DISM 記錄檔
部署映像服務與管理工具
版本: 6.1.7600.16385
映像版本: 6.1.7600.16385
錯誤: 0x800f080c
功能名稱 MicrosoftWindowsPowerShell 未知。
無法辨識 Windows 功能名稱。
請使用 /Get-Features 選項找出映像中的功能名稱,並重新嘗試命令。
在 C:\Windows\Logs\DISM\dism.log 中可找到 DISM 記錄檔
About to create folder and copy Powershell module.
Press [ctrl][c] to abort or
請按任意鍵繼續 . . .
子目錄或檔案 C:\Program Files\modules\HyperV 已經存在。
C:\PsHyperV\install.cmd\..\HyperV\disk.ps1
C:\PsHyperV\install.cmd\..\HyperV\En-us.ps1
C:\PsHyperV\install.cmd\..\HyperV\Helper.ps1
C:\PsHyperV\install.cmd\..\HyperV\hyperv.format.ps1xml
C:\PsHyperV\install.cmd\..\HyperV\HyperV.psd1
C:\PsHyperV\install.cmd\..\HyperV\Maml-Helper.XML
C:\PsHyperV\install.cmd\..\HyperV\maml-vm.xml
C:\PsHyperV\install.cmd\..\HyperV\maml-vmconfig.xml
C:\PsHyperV\install.cmd\..\HyperV\maml-vmDisk.xml
C:\PsHyperV\install.cmd\..\HyperV\MAML-VMNetwork.XML
C:\PsHyperV\install.cmd\..\HyperV\MAML-VMSnapshot.XML
C:\PsHyperV\install.cmd\..\HyperV\menu.ps1
C:\PsHyperV\install.cmd\..\HyperV\Network.ps1
C:\PsHyperV\install.cmd\..\HyperV\SnapShot.ps1
C:\PsHyperV\install.cmd\..\HyperV\v1Compatability.ps1
C:\PsHyperV\install.cmd\..\HyperV\vm.ps1
C:\PsHyperV\install.cmd\..\HyperV\VMConfig.ps1
複製了 17 個檔案。
About to set registry entries for PowerShell script execution, module path and c
onsole settings
Press [ctrl][c] to abort or
請按任意鍵繼續 . . .
About to Launch the PowerShell for HyperV
Press [ctrl][c] to abort or
請按任意鍵繼續 . . .

請問這樣算是安裝成功了嗎?感恩
您可以,嘗試依照網站的指令打看看,如果有成功就會有相關的訊息,正常來說正樣就是OK了....
-
2012年2月21日 上午 09:05
您可以,嘗試依照網站的指令打看看,如果有成功就會有相關的訊息,正常來說正樣就是OK了....
感謝回覆,剛剛測試了一下執行Get-VMHost
PS C:\PsHyperV> Get-VMHost
HyperV-1
HyperV-2看起來安裝應該是OK了,不知道有沒有更多關於指令用法的說明呢?
因為官網上面只有寫例如:
Finding a VM
Get-VM, Choose-VM , Get-VMHost
但是實際執行Get-VM也是錯誤
感恩 ^^
- 已編輯 DannyLee 2012年2月21日 上午 09:25
-
2012年2月21日 上午 09:28
各位好!
剛剛已經有參考下面的文件:http://pshyperv.codeplex.com/discussions/85922
執行下列指令:
Export-VM -server "HyperV-1" -vm "WIN2003R2" -path C:\ -copystate -wait -force
目前看起來已經有在執行了,剩下的應該就是把指令放到排程裡面去了,應該就是這樣吧!
如果上述指令不正確的話,還請各位指正,感恩...
- 已提議為解答 西城和也 2012年2月21日 上午 09:42
-
2012年2月21日 上午 09:36
看起來這樣的指令沒錯。各位好!
剛剛已經有參考下面的文件:http://pshyperv.codeplex.com/discussions/85922
執行下列指令:
Export-VM -server "HyperV-1" -vm "WIN2003R2" -path C:\ -copystate -wait -force
目前看起來已經有在執行了,剩下的應該就是把指令放到排程裡面去了,應該就是這樣吧!
如果上述指令不正確的話,還請各位指正,感恩...
以上說明若有錯誤請指教,謝謝。
http://www.dotblogs.com.tw/terrychuang/ -
2012年2月22日 上午 03:36
剛剛測試後又發現,如果匯出的是在該主機的磁碟路徑是OK的,但是如果要匯出到其他的主機,好像會錯誤,詳細內容如下:
PS C:\PsHyperV> export-vm -server hyperv-1 -vm win2003r2 -path \\hyperv-2\MSSCVMMLibrary -copystate -wait -force
Test-WMIResult : Attempt to export win2003r2 to \\hyperv-2\MSSCVMMLibrary failed. :
無法建立名稱為 '\\hyperv-2\MSSCVMMLibrary\win2003r2' 的匯出目錄,錯誤為 '發生一般性存取被拒的錯誤' (0x8007
0005): win2003r2 (DF5E1E53-E224-430D-B32D-ADA168A672D5)
+
位於 C:\Program Files\modules\hyperV\VM.ps1:28 字元:113
+ if ( ($VSMgtSvc.ExportVirtualSystem($VM.__path,($CopyState.Ispresent),$path)
| Test-wmiResult <<<< -wait:($wait -or $preserve) -JobWaitText ($lstr_ExportOfVm -f $vm.ele
mentName)`
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Test-WMIResult剛剛看了一下,好像也有人遇到相同的問題: http://pshyperv.codeplex.com/discussions/286018
請問這個問題有解嗎?感恩...
- 已編輯 DannyLee 2012年2月22日 上午 03:44
-
2012年2月22日 上午 05:03
剛剛測試後又發現,如果匯出的是在該主機的磁碟路徑是OK的,但是如果要匯出到其他的主機,好像會錯誤,詳細內容如下:
PS C:\PsHyperV> export-vm -server hyperv-1 -vm win2003r2 -path \\hyperv-2\MSSCVMMLibrary -copystate -wait -force
Test-WMIResult : Attempt to export win2003r2 to \\hyperv-2\MSSCVMMLibrary failed. :
無法建立名稱為 '\\hyperv-2\MSSCVMMLibrary\win2003r2' 的匯出目錄,錯誤為 '發生一般性存取被拒的錯誤' (0x8007
0005): win2003r2 (DF5E1E53-E224-430D-B32D-ADA168A672D5)
+
位於 C:\Program Files\modules\hyperV\VM.ps1:28 字元:113
+ if ( ($VSMgtSvc.ExportVirtualSystem($VM.__path,($CopyState.Ispresent),$path)
| Test-wmiResult <<<< -wait:($wait -or $preserve) -JobWaitText ($lstr_ExportOfVm -f $vm.ele
mentName)`
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Test-WMIResult剛剛看了一下,好像也有人遇到相同的問題: http://pshyperv.codeplex.com/discussions/286018
請問這個問題有解嗎?感恩...
或許你可以參考這篇文章。
以上說明若有錯誤請指教,謝謝。
http://www.dotblogs.com.tw/terrychuang/

