Bare Metal Deploy through VMM PowerShell (Part 1)
Most ITpros follow an automated process when deploying OS to bare metal servers, and when it comes to VMM (Virtual Machine Manager) there is a really nice built-in feature for this bare-metal deployment.
System Center 2012 SP1 (VMM) includes several enhancements to this feature, and the most important among them are:
1. Deep Discovery that offers more detailed insight into the to-be-provisioned hardware. This takes advantage of Consistent Device Naming (CDN) feature.
2. Expanded host profile that allows logical switch (single management construct for multiple virtual switch instance) & host vNIC configuration at design time.
3. The ability to allow boot disk selection post-Deep Discovery.
4. An increase in the max number of hosts under VMM management.
The Limitations of using the VMM Console
While it is possible to perform the end-to-end bare-metal deployment through VMM Console it has a few limitations, such as running through the UI wizard every time a bare metal (or set of physical machines) needs to be provisioned, and previous deep discovery results are not available for re-use and thus have to be deep discovered again (which in turn results in power cycle of those bare metal servers).
The Solution through the PowerShell Approach:
The PowerShell approach is very handy and re-usable – especially when many servers need to be provisioned in the offline mode in an automated way. This post features tips on using the bare-metal Cmdlets in VMM.
Before using the PowerShell, make sure you have the pre-requisites to run through the Cmdlets:
· Bare Metal machine to deploy OS (BIOS to support virtualization, PXE network boot is configured, and IP address and Logon credentials for BMC are configured).
· Native Boot VHD (VHD/VHDX) file stored in VMM Library.
· WDS/PXE server is added to VMM.
· Create Host Profile using native boot VHD in VMM Library.
· Create one or more Logical Networks to map to the NICs on bare-metal servers (the use of Logical Switch for networking will be covered in the next post in Part 2).
· Create necessary RunAsAccount (RAA).
- BMC Administrator (BMCAdmin).
Here are six basic steps to follow:
1. Discover bare metal computers from an IP address “10.10.0.1” (No Deep Discovery).
$BMCAddress = “10.10.0.1”
$BMCRunAsAccount = Get-SCRunAsAccount $BMCAccount $MyComputer01 = Find-SCComputer -BMCAddress $BMCAddress –BMCRunAsAccount $BMCRunAsAccount -BMCProtocol "IPMI" |
Sample output of discovered computer ($MyComputer01)
PS C:Windowssystem32> $MyComputer01
BMCType : IPMI BMCProtocolVersion : 2.0 (DCMI 1.0) BMCAddress : 10.10.0.1 BMCPort : SMBiosGUID : 81eb23a4-a99b-df11-ad41-1cc1de7ba767 SerialNumber : AssetTag : FirmwareVersion : 4.22 Model : Manufacturer : ComputerPowerState : Off Error : PhysicalMachine : Microsoft.VirtualManager.Remoting.DeepDiscoveryData |
2. Perform Deep Discovery operation on discovered bare metal computer.
$MyComputer01 = Find-SCComputer -DeepDiscovery -BMCAddress $MyComputer01.BMCAddress -BMCRunAsAccount $BMCRunAsAccount -BMCProtocol "IPMI" -SMBIOSGUID $MyComputer01.SMBIOSGUID |
Sample output of deep discovery for $MyComputer01 (Computer).
PS C:Windowssystem32> $MyComputer01.PhysicalMachine.Computer
ProcessorManufacturer : AuthenticAMD ProcessorName : AMD Opteron(tm) Processor 6128 ProcessorClockSpeedMHz : 2000 NumberOfProcessors : 8 TotalPhysicalMemory : 17178025984 BiosVersion : Default System BIOS |
Sample output of deep discovery for $MyComputer01 (Network Adapters).
PS C:Windowssystem32> $MyComputer01.PhysicalMachine.NetworkAdapters
CommonDeviceName : Ethernet MacAddress : D4:85:64:4C:8B:5E DeviceID : 1 ProductName : Intel(R) 82576 Gigabit Dual Port Network Connection Manufacturer : Intel Corporation State : Connected DataRate : 1000000000 |
Sample output of deep discovery for $MyComputer01 (Disks).
PS C:Windowssystem32> $MyComputer01.PhysicalMachine.Disks
DeviceName : \.PHYSICALDRIVE0 Name : HP LOGICAL VOLUME SCSI Disk Device Capacity : 500071956480 BusType : SCSI Bus : 0 Target : 4 Lun : 0 Status : OK PhysicalSectorSize : 512 LogicalSectorSize : 512 SerialNumber : PACCRCN80ZI1YXC |
3. Perform Network Adapter Configuration using Deep Discovery output.
$LogicalNetwork=Get-SCLogicalNetwork -name "LNForBMC"
$NetworkAdapterConfig = @() $MyComputer01.PhysicalMachine.NetworkAdapters | ForEach-Object { if($_.CommonDeviceName -eq "Ethernet 3") { $NetworkAdapterConfig += New-SCVMHostNetworkAdapterConfig -SetAsPhysicalNetworkAdapter -SetAsManagementNIC -UseStaticIPForIPConfiguration -LogicalNetwork $LogicalNetwork -IPv4Subnet "10.10.0.1/26" -MACAddress $_.MacAddress } else { $NetworkAdapterConfig += New-SCVMHostNetworkAdapterConfig -SetAsPhysicalNetworkAdapter -SetAsGenericNIC -UseStaticIPForIPConfiguration -LogicalNetwork $LogicalNetwork -IPv4Subnet "10.10.0.1/26" -MACAddress $_.MacAddress } } |
Sample output of Network Adapter Configuration (Physical NIC).
PS C:Windowssystem32> $networkadapterconfig[0]
TransientManagementNetworkAdapter : MacAddress : D4:85:64:4C:8B:62 IPv4Subnet : 10.10.0.1/26 IPv6Subnet : IPv4Address : IPv6Address : IsPhysicalNetworkAdapter : True IsVirtualNetworkAdapter : False IsManagementNic : True IsGenericNic : False UseDhcpForIPConfiguration : False UseStaticIPForIPConfiguration : True LogicalSwitch : UplinkPortProfileSet : PortClassification : LogicalNetwork : LNForBMC VMNetwork : ObjectType : VMHostNetworkAdapterConfig Accessibility : Public Name : VMHostNetworkAdapterConfig-3edd0ef0-de88-40e2-9cb7-538927992257 IsViewOnly : False Description : AddedTime : 2/21/2013 12:11:13 AM ModifiedTime : 2/21/2013 12:11:13 AM Enabled : True MostRecentTask : Create a new host network adapter configuration ServerConnection : Microsoft.SystemCenter.VirtualMachineManager.Remoting.ServerConnection ID : 3edd0ef0-de88-40e2-9cb7-538927992257 MarkedForDeletion : False IsFullyCached : True MostRecentTaskIfLocal : Create a new host network adapter configuration |
4. Perform BMC Host Configuration using Deep Discovery output.
$ComputerName=”TestBMCMachine”
$BMCRAA = Get-SCRunAsAccount -Name “BMCAdmin” $HostGroup = Get-SCVMHostGroup -Name “All Hosts” $HostProfile = Get-SCVMHostProfile -Name “TestHostProfile2” $BootVolumeDisk=$MyComputer01.PhysicalMachine.Disks.DeviceName[0] $BMCHostConfiguration = New-SCVMHostConfig -BMCAddress $MyComputer01.BMCAddress -SMBiosGuid $MyComputer01.SMBIOSGUID -BMCPort 623 -BMCProtocol "IPMI" -BMCRunAsAccount $BMCRAA -BypassADMachineAccountCheck -ComputerName $ComputerName -Description "" -VMHostGroup $HostGroup -VMHostProfile $HostProfile -VMHostNetworkAdapterConfig $NetworkAdapterConfig -BootDiskVolume $BootVolumeDisk |
Sample output of BMC Host Configuration (Physical Server).
PS C:Windowssystem32> $VMHostConfiguration
VMHostProfile : TestHostProfile2 BmcAddress : 10.10.0.1 BmcCustomConfigurationProvider : BmcPort : 623 BmcProtocol : IPMI BmcRunAsAccount : BMCAdmin BypassADMachineAccountCheck : True ComputerName : MyBMCComputer01 SMBiosGuid : 81eb23a4-a99b-df11-ad41-1cc1de7ba767 VMHostGroup : All Hosts BootDiskVolume : \.PHYSICALDRIVE0 VMHostNetworkAdapterConfigs : {VMHostNetworkAdapterConfig-3edd0ef0-de88-40e2-9cb7-538927992257} ObjectType : VMHostConfig Accessibility : Public Name : VMHostConfig-982f22af-1b1c-4f8d-9f83-34eba2bc3871 IsViewOnly : False Description : AddedTime : 2/21/2013 12:11:29 AM ModifiedTime : 2/21/2013 12:11:29 AM Enabled : True MostRecentTask : Create a new host configuration ServerConnection : Microsoft.SystemCenter.VirtualMachineManager.Remoting.ServerConnection ID : 982f22af-1b1c-4f8d-9f83-34eba2bc3871 MarkedForDeletion : False IsFullyCached : True MostRecentTaskIfLocal : Create a new host configuration |
5. Deploy OS to Bare Metal using BMC Host Configuration.
New-SCVMHost -VMHostConfig $BMCHostConfiguration -RunAsynchronously |
6. Check the VMM Job output for the completion of Job and also check the target BMC machine for the installation of OS.
Summary
The goal of this post is to show the sequence of steps or Cmdlets required to provision bare metal server.
Use the above Cmdlets as reference and make sure the hard coded values are replaced to match the environment.
In the next post of this series, I will walk through the steps required while using Logical Switch which helps enable the NIC Teaming and Hyper-V QoS features of Windows Server 2012.
Comments
Anonymous
January 01, 2003
Thanks for the comment. Yes, the option in IPMI to select the boot device to use on the next boot is not specified in VMM and so the user has to make sure the machine is set to boot from the network.Anonymous
January 01, 2003
That doesn't really solve it per se, the proper idea should be to issue a boot from PXE via IPMI, this seems possible through other IPMI tools as we use it in our current deployment tools. Thanks for the clarification though.Anonymous
January 01, 2003
Great article, this is exactly what I had been looking for. But is there any reason why the IPMI power cycle doesn't initiate a PXE boot afterwards to boot into the SCVMM PXE image for a deep discovery?Anonymous
January 01, 2003
What I don't get is why do I need to perform step 3 (map deep discovery with physical network adapters) when I've configured my network configuration (physical/virtual NICs, CDN's etc) in the host profile.Anonymous
January 01, 2003
Thanks for the comment. Here is couple of items to check for:
- BIOS boot order to boot from a PXE enabled network adapter as the first device
- Logon credential and IP address settings are configured for the BMC on the physical computer
- The PXE server is added to VMM Server with no errors (VMM Job) and in responding state
- Also, check on PXE server for the addition of PXE boot image from VMM Server in the directory - C:RemoteInstallDCMgrBootWindowsImagesBoot.wim
- Make sure PXE server is installed with both "Deployment Server" and "Transport Server" options and respond to client is selected Hope this helps solving your PXE boot issue.