How should you build a set of PowerShell commands to achieve this goal?

DRAG DROP
A company has a Windows Server 2008 R2 Hyper-V server environment. The environment
is managed by using Microsoft Machine Manager (VMM) 2008 R2.
An existing virtual machine (VM) named VM04 must be cloned to a new VM, named VM03,
on the same host. The VM must be stored on a local disk.
You need to clone VM04 to VMQ3.
How should you build a set of PowerShell commands to achieve this goal? (To answer, drag
the appropriate phrase from the list of answer chores to the correct location or locations in
the answer area.)

DRAG DROP
A company has a Windows Server 2008 R2 Hyper-V server environment. The environment
is managed by using Microsoft Machine Manager (VMM) 2008 R2.
An existing virtual machine (VM) named VM04 must be cloned to a new VM, named VM03,
on the same host. The VM must be stored on a local disk.
You need to clone VM04 to VMQ3.
How should you build a set of PowerShell commands to achieve this goal? (To answer, drag
the appropriate phrase from the list of answer chores to the correct location or locations in
the answer area.)

Answer:

Explanation:
(Question is open to discussion)
Answer changed 12/06/2012
FROM Get-VMMServer, Get-VM, VM04, Set-VM, VM03 TO Get-VMMServer, Get-VM,
VM04, Get- VMHost, VM03
Windows commands
Get-VMMServer (Windows cmd)
Connecting to the Virtual Machine Manager Server
Applies To: Virtual Machine Manager 2008, Virtual Machine Manager 2008 R2, Virtual
Machine Manager 2008 R2 SP1
You can display Help about System Center Virtual Machine Manager (VMM) cmdlets at any
time in the Windows PowerShell – Virtual Machine Manager command shell. However, you
can use the VMM cmdlets only after you connect to a VMM server.
Connecting to a VMM server retrieves the server object from the VMM database and gives
you access to all the other objects in the database. You retain access to the objects in the
database until you close the server connection, which you can do by closing the VMM
command shell.
To connect to the Virtual Machine Manager server
Type the following command, and then review the output. Replace the placeholders with
your own server and domain names:
Get-VMMServer –Computername “<YourVMMServerName>.<YourDomainName>.com”
When the command has successfully completed, the server object is returned. The
command shell displays information about the properties of the VMM server object. And, you
are connected to the VMM database that is provided by the VMM server.
If a command does not work in the command shell, run the command to connect to the VMM
server again. If you encounter problems, open the Services tool in Administrative Tools, and
then restart the VMM service. Or, restart the service in the command shell. For information
about how to restart a service in the command shell, type Get-Help Restart-Service –
detailed.
If you are working on the server on which VMM is installed, you can substitute “localhost” for
the fully qualified domain name (FQDN). You cannot do this if you are accessing the server
remotely.
To connect to Virtual Machine Manager if it is installed on the local host
Type the following command, and then review its output:
Get-VMMServer –Computername localhost

http://technet.microsoft.com/en-us/library/cc764276.aspx
Virtual Machines (Windows cmd)
Set-Vm
Change the configuration of a VM
Set-VM -VM (Get-VM -Name ”Win XP SP1”) -Name ”Win XP SP2“ -GuestId
”winXPProGuest“
-Description ”My updatedWin XP virtual machine.“
The Set-VM cmdlet configures a virtual machine.
Examples
Example 1
Configures virtual machine TestVM to shut down when the Hyper-V host shuts down.
PS C:\> Set-VM –Name TestVM –AutomaticStopAction Shutdown
Example 2
Stops virtual machine TestVM, sets it to use dynamic memory, sets its maximum amount of
memory to 2GB, sets it to use 2 virtual processors, and starts it.
PS C:\> Stop-VM -Name TestVM -Passthru | Set-VM -ProcessorCount 2 -DynamicMemory –
MemoryMaximumBytes 2GB -Passthru | Start-VM
Provision VM (Windows cmd)
VI PowerScripter
To create a new VM (Windows cmd)
$esxhost = Get-VMHost ”ESXHost01 .mydomain.com“
New-VM -Name XPVM -VMHost $esxhost -DiskMB 4000 -MemoryMB 256
Creates a new virtual machine.
Examples
Example 1
Creates a new virtual machine named new 1 that has 512MB of memory.
PS C:\> New-VM –Name “new 1” –MemoryStartupBytes 512MB
Example 2
Creates a virtual machine named new 2 that has 1GB of memory and that is connected to a
new 40GB VHDX file.
PS C:\> New-VM –Name “new 2” –MemoryStartupBytes 1GB –NewVHDPath
d:\vhd\base.vhdx
Example 3
Creates a virtual machine named new 3 that has 1GB of memory and is connected to an
existing VHDX file.
PS C:\> New-VM –Name “new 3” –MemoryStartupBytes 1GB –VHDPath
d:\vhd\BaseImage.vhdx
To Remove a VM:
Remove-VM ( Get-VM “myVM” ) –DeleteFromDisk
Templates (Windows cmd)
$template = Get-Template -Name Templ* -Location (Get-Datacenter DC)
Remove-Template –
Template $template
New-Template -VM ( Get-VM XPVM ) -Name Template01 -Location (Get-Datacenter DC)
Set-Template -Template $template -ToVM
# convert Template to VM
How to Create a Virtual Machine Template
http://technet.microsoft.com/en-us/library/bb740832.aspx
Guest Customization Specification
$osspec = Get-OSCustomizationSpec WinXP
# reads Guest Customization Specification object

New-VM -Name MyVM2 -Template Template01 -VMHost ESX01 -OSCustomizationSpec
$osspec
other OS Customization CmdLets:
New-OSCustomizationSpec
Set-OSCustomizationSpec
http://technet.microsoft.com/en-us/library/cc967317



Leave a Reply 0

Your email address will not be published. Required fields are marked *