Initialize
1. Start Powershell via command lineC:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -PSConsoleFile "C:/Program Files/Microsoft System Center Virtual Machine Manager 2008 R2/bin/cli.psc1" -NoExit
|
Restore
1. Connect to the Virtual Machine Manager (VMM) server, server name: sst-scvmm-server$VMMServer = Get-VMMServer -ComputerName " sst-scvmm-server "
|
2. Get image object "vm" from Image Library Server:sst-image-2.adobenet.global.adobe.com$VMName=get-vm|where {$_.LibraryServer.Name -eq "sst-image-2.adobenet.global.adobe.com"}
|
3. Get and sort the host ratings for all the hosts in the host group , return sorted host array$HostRatings = Get-VMHostRating -VM $VMName | where { $_.Rating -gt 0 } | Sort-Object -property Rating -descending
If($HostRatings.Count -eq "0") { throw "No hosts meet the requirements." }
|
4. Set new vm's hardware as requestNew-HardwareProfile -Name "LargeHAVM" -CPUCount 4 -MemoryMB 64000 -CPUMax 100 -Owner "User1@Contoso" –CPUType “Intel Core 2” $HardwareProfile = Get-HardwareProfile | where {$_.Name -eq " LargeHAVM"}
|
5. Create new vm and deploy it on "vmhost", vmhost is the highest rate hostnew-vm -vm $ VMName -Name "VM05" -Description "New VM from VM stored" -owner "adobenet/bjsstqe" -vmhost $vmhost -path "c:/programdata/microsof t/windows/hyper-v" -HardwareProfile $HardwareProfile
|
6. Set new vm's MAC address as assigned$vm=get-vm|where {$_.name -eq " VM05"} $vm_network=get-virtualnetworkadapter -vm $vm Set-VirtualNetworkAdapter -VirtualNetworkAdapter $vm_network -physicaladdress "00-00-00-00-00-00-00-E0"
|
7. Startup-VMCheckpoint (Snapshot)
1. Create checkpoint for VM “VM01” and name it as “VM01-CP01”Get-VM -name "VM01" | New-VMCheckpoint -name " VM01-CP01" (Need to try)
|
2. Create a new VM based on “VM01” and store the VM to Image Library Server “Image-Lib.pac.adobe.com”Get-VM -VMMServer localhost -Name " VM01" | where {$_.VMHost.Name -eq "sst-hyperv-2.adobenet.global.adobe.com"}
|
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理