So i have configured one of my VM's with all the required config and need to apply to all VM's on the same Server. 200+ VM's
I can read code but cannot write it and i understand that some of the content is specific, but is there a way to generalize. Run though each VM 1 by 1 and apply the config as outlined in the SCVMM ( View Script )
Same OS, Same Network, Same Vlan, Same Owner, Same Memory etc
I have to run through 200+ VM's manually tonight if i cant script this.
$VirtualNetworkAdapter = Get-SCVirtualNetworkAdapter -VMMServer ch01vmvmm01.xxxx.com -Name "PI-2K12R1-Template_V1" -ID "45a7e10c-9967-4949-9fdd-4dab29226a87"$VMNetwork = Get-SCVMNetwork -VMMServer ch01vmvmm01.xxxx.com -Name "Production Networks" -ID "63ebe090-b1b1-4e0c-b61f-54a509a970a2"
Set-SCVirtualNetworkAdapter -VirtualNetworkAdapter $VirtualNetworkAdapter -VMNetwork $VMNetwork -VLanEnabled $true -VLanID 700 -VirtualNetwork "VM-DOMAIN" -MACAddressType Dynamic -IPv4AddressType Dynamic -IPv6AddressType Dynamic -NoPortClassification -EnableVMNetworkOptimization $false -JobGroup d7b603af-d95b-4fa9-ace0-1d4a8c39f2ec
$VM = Get-SCVirtualMachine -VMMServer ch01vmvmm01.xxxx.com -Name "PI-2K8R2-Template_V1" -ID "8863fd52-ac0b-4c21-8475-3942d8cf474b" | where {$_.VMHost.Name -eq "uk02svhv91.xxxx.xxxx.com"}
$OperatingSystem = Get-SCOperatingSystem -VMMServer ch01vmvmm01.xxxx.com -ID "56a7486f-b989-4bd3-b38a-a6c4bb206f1b" | where {$_.Name -eq "64-bit edition of Windows Server 2008 R2 Standard"}
$UserRole = Get-SCUserRole -VMMServer ch01vmvmm01.xxxx.com -Name "Administrator" -ID "75700cd5-893e-4f68-ada7-50ef4668acc6"
$CPUType = Get-SCCPUType -VMMServer ch01vmvmm01.xxxx.com | where {$_.Name -eq "3.60 GHz Xeon (2 MB L2 cache)"}
$Cloud = Get-SCCloud -VMMServer ch01vmvmm01.xxxx.com | where {$_.Name -eq "UK02-DEV"}
Set-SCVirtualMachine -VM $VM -Name "PI-2K8R2-Template_V1" -Description "" -OperatingSystem $OperatingSystem -Owner "EMEA\username" -UserRole $UserRole -CPUCount 1 -MemoryMB 8192 -DynamicMemoryEnabled $false -MemoryWeight 5000 -VirtualVideoAdapterEnabled $false -CPUExpectedUtilizationPercent 20 -DiskIops 0 -CPUMaximumPercent 100 -CPUReserve 0 -NumaIsolationRequired $false -NetworkUtilizationMbps 0 -CPURelativeWeight 100 -HighlyAvailable $false -DRProtectionRequired $false -NumLock $false -BootOrder "CD", "IdeHardDrive", "PxeBoot", "Floppy" -CPULimitFunctionality $false -CPULimitForMigration $false -CPUType $CPUType -Tag "(none)" -QuotaPoint 1 -JobGroup d7b603af-d95b-4fa9-ace0-1d4a8c39f2ec -RunAsynchronously -StartAction NeverAutoTurnOnVM -StopAction SaveVM -BlockDynamicOptimization $false -Cloud $Cloud -EnableOperatingSystemShutdown $true -EnableTimeSynchronization $true -EnableDataExchange $true -EnableHeartbeat $true -EnableBackup $true
$vm = Get-SCVirtualMachine -Name "PI-2K8R2-Template_V1" -ID "8863fd52-ac0b-4c21-8475-3942d8cf474b"
Grant-SCResource -Resource $vm -UserRoleID @("ffa99893-13a1-450f-b4b1-0f11c2638328", "13fb2d0b-52fd-4c2a-98ec-e25020b9fbba") -RunAsynchronously
Regards, Alan.