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 “” (No Deep Discovery).

$BMCAddress = “”

$BMCRunAsAccount = Get-SCRunAsAccount $BMCAccount

$MyComputer01 = Find-SCComputer -BMCAddress $BMCAddress –BMCRunAsAccount $BMCRunAsAccount -BMCProtocol “IPMI”

Sample output of discovered computer ($MyComputer01)

PS C:Windowssystem32> $MyComputer01


BMCProtocolVersion : 2.0 (DCMI 1.0)

BMCAddress :

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



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 “” -MACAddress $_.MacAddress




$NetworkAdapterConfig += New-SCVMHostNetworkAdapterConfig -SetAsPhysicalNetworkAdapter -SetAsGenericNIC -UseStaticIPForIPConfiguration -LogicalNetwork $LogicalNetwork -IPv4Subnet “” -MACAddress $_.MacAddress



Sample output of Network Adapter Configuration (Physical NIC).

PS C:Windowssystem32> $networkadapterconfig[0]

TransientManagementNetworkAdapter :

MacAddress : D4:85:64:4C:8B:62

IPv4Subnet :

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.


$BMCRAA = Get-SCRunAsAccount -Name “BMCAdmin”

$HostGroup = Get-SCVMHostGroup -Name “All Hosts”

$HostProfile = Get-SCVMHostProfile -Name “TestHostProfile2”


$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 :

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.


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.