$Template = Get-Template -VMMServer localhost | where {$_.Name -eq "Serber 2008 R2 _clean"}
$VMHost = Get-VMHost -VMMServer localhost | where {$_.Name -eq "hyp-1.mafoberg.net"}

New-VM -Template $Template -Name "testserber" -VMHost $VMHost -Path "C:\ClusterStorage\Volume1" -JobGroup 4e5b50e5-120c-41da-a9f2-154851f03208 -RunAsynchronously -Owner "MAFOBERG\Administrator" -AnswerFile $null -RunAsSystem -StartAction NeverAutoTurnOnVM -StopAction SaveVM 



# ------------------------------------------------------------------------------
# New Virtual Machine Script
# ------------------------------------------------------------------------------
# Script generated on 11. mai 2010 14:06:20 by Virtual Machine Manager
# 
# For additional help on cmdlet usage, type get-help <cmdlet name>
# ------------------------------------------------------------------------------


Set-VirtualFloppyDrive -RunAsynchronously -VMMServer localhost -NoMedia -JobGroup 97d6eb96-cba1-48af-be85-2d4f7138f624 


Set-VirtualCOMPort -NoAttach -VMMServer localhost -GuestPort 1 -JobGroup 97d6eb96-cba1-48af-be85-2d4f7138f624 


Set-VirtualCOMPort -NoAttach -VMMServer localhost -GuestPort 2 -JobGroup 97d6eb96-cba1-48af-be85-2d4f7138f624 


New-VirtualNetworkAdapter -VMMServer localhost -JobGroup 97d6eb96-cba1-48af-be85-2d4f7138f624 -PhysicalAddressType Dynamic -VirtualNetwork "Virtual Network Switch Mafoberg" -VLanEnabled $false -MACAddressesSpoofingEnabled $false 


New-VirtualDVDDrive -VMMServer localhost -JobGroup 97d6eb96-cba1-48af-be85-2d4f7138f624 -Bus 1 -LUN 0 

$CPUType = Get-CPUType -VMMServer localhost | where {$_.Name -eq "1.20 GHz Athlon MP"}


New-HardwareProfile -VMMServer localhost -Owner "MAFOBERG\Administrator" -CPUType $CPUType -Name "Profile0f215bfe-0eaf-4a21-b8ff-c46c2ff4708e" -Description "Profile used to create a VM/Template" -CPUCount 1 -MemoryMB 768 -ExpectedCPUUtilization 20 -DiskIO 0 -CPUMax 100 -CPUReserve 0 -NetworkUtilization 0 -RelativeWeight 100 -HighlyAvailable $true -NumLock $true -BootOrder "CD", "IdeHardDrive", "PxeBoot", "Floppy" -LimitCPUFunctionality $false -LimitCPUForMigration $true -JobGroup 97d6eb96-cba1-48af-be85-2d4f7138f624 


$Template = Get-Template -VMMServer localhost | where {$_.Name -eq "Serber 2008 R2 _clean"}
$VMHost = Get-VMHost -VMMServer localhost | where {$_.Name -eq "hyp-1.mafoberg.net"}
$HardwareProfile = Get-HardwareProfile -VMMServer localhost | where {$_.Name -eq "Profile0f215bfe-0eaf-4a21-b8ff-c46c2ff4708e"}

$OperatingSystem = Get-OperatingSystem -VMMServer localhost | where {$_.Name -eq "64-bit edition of Windows Server 2008 R2 Standard"}

New-VM -Template $Template -Name "serbertest" -Description "" -VMHost $VMHost -Path "C:\ClusterStorage\Volume1" -JobGroup 97d6eb96-cba1-48af-be85-2d4f7138f624 -RunAsynchronously -Owner "MAFOBERG\Administrator" -HardwareProfile $HardwareProfile -ComputerName "*" -FullName "" -OrgName "" -TimeZone 110 -JoinWorkgroup "WORKGROUP"  -AnswerFile $null -OperatingSystem $OperatingSystem -RunAsSystem -StartAction NeverAutoTurnOnVM -StopAction SaveVM 







