I had a situation where I needed to enable the Virtualisation Technology (VT) across a bunch of Dell servers and then install the Hyper-V role. It turned out to be much simpler than I originally thought thanks in part to PowerShell remoting and Dells omconfig.
Dell give you the option to change BIOS configuration from the command line, for example to enable the CPU VT:
omconfig chassis biossetup attribute=cpuvt setting=enabled
In addition to the above I would also need to install the Hyper-V role:
Import-Module ServerManager ; Add-WindowsFeature Hyper-V
This can be combined into a PowerShell remote command like so ($allServers is an array of all the server host names I want to execute the command against):
icm -ComputerName $allServers -ScriptBlock { omconfig chassis biossetup attribute=cpuvt setting=enabled ; Import-Module ServerManager ; Add-WindowsFeature Hyper-V }
Next I needed to create a software virtual switch, for this I used a script from
$VirtualSwitchService = get-wmiobject -class "Msvm_VirtualSwitchManagementService" -namespace "root\virtualization" $ReturnObject = $VirtualSwitchService.CreateSwitch([guid]::NewGuid().ToString(), "DELL NETWORK TEAM - Virtual Network", "1024","") #Create New Virtual Switch $CreatedSwitch = [WMI]$ReturnObject.CreatedVirtualSwitch #Create Internal Switch Port $ReturnObject = $VirtualSwitchService.CreateSwitchPort($CreatedSwitch, [guid]::NewGuid().ToString(), "InternalSwitchPort", "") $InternalSwitchPort = [WMI]$ReturnObject.CreatedSwitchPort #Create External Switch Port $ReturnObject = $VirtualSwitchService.CreateSwitchPort($CreatedSwitch, [guid]::NewGuid().ToString(), "ExternalSwitchPort", "") $ExternalSwitchPort = [WMI]$ReturnObject.CreatedSwitchPort $ExternalNic = get-wmiobject -namespace "root\virtualization" -Query "Select * From Msvm_ExternalEthernetPort WHERE IsBound=False" | ? { $_.Name -eq 'BASP Virtual Adapter'} #Call SetupSwitch $Job = $VirtualSwitchService.SetupSwitch($ExternalSwitchPort, $InternalSwitchPort, $ExternalNic, [guid]::NewGuid().ToString(), "InternalEthernetPort") while (([WMI]$Job.Job.JobState -eq 2) -or ([WMI]$Job.Job.JobState -eq 3) -or ([WMI]$Job.Job.JobState -eq 4)) {Start-Sleep -m 100} [WMI]$Job.Job
And finally reboot them all (they actually reboot twice as part of the Hypervisor installtion):
icm -ComputerName $allServers -ScriptBlock { Restart-Computer -Force }
With the above I managed to enable and install Hyper-V across 70 severs simultaneously with less than a couple of hours of effort, nice!
Kind Regards,
jfrmilner