Installing WIndows Server NT 4.0 on Hyper-V Server

Sometimes this is still required for lab testing and migration scenarios!

Create the VM with a legacy Network adapter and afterwards run the following from elevated PowerShell:

Set-VMProcessor NT4 -CompatibilityForOlderOperatingSystemsEnabled $true

Where NT4 is the name of the VM.

If the VM is part of a cluster, need to do the following,

.\get-vmcluster.ps1 NT4 | Set-VMProcessor -CompatibilityForOlderOperatingSystemsEnabled $true

Where get-vmcluster.ps1 is as follows http://www.altaro.com/hyper-v/powershell-script-hyper-v-get-clustervm/

<#
.SYNOPSIS
Retrieves clustered virtual machines.
.DESCRIPTION
Enumerates the virtual machine resources on a cluster and retrieves the related virtual machine object.
If specific VM names are supplied, only those objects are retrieved.
.PARAMETER VMName
A string array that specifies the names of VMs to look for.
.PARAMETER Cluster
The cluster to scan for virtual machines.
Accepts a string that contains the cluster or any node name.
Accepts a Cluster object (from Get-Cluster).
Accepts a VMHost object (from Get-VMHost).
.OUTPUTS
Microsoft.Virtualization.Powershell.VirtualMachine
.EXAMPLE
C:\PS> .\Get-ClusterVM
Description
———–
Retrieves all VMs on the cluster that this computer is a member of.
.EXAMPLE
C:\PS> .\Get-ClusterVM svMail1
Description
———–
Retrieves the VM named “svMail1” on the cluster that this computer is a member of.
.EXAMPLE
C:\PS> .\Get-ClusterVM svMail1, svSQL1 hvcluster1
Description
———–
Retrieves the virtual machines named “svMail1” and “svSQL1” from the cluster named “hvcluster1”
.EXAMPLE
C:\PS> .\Get-ClusterVM -VMName svMail1, svSQL1 -Cluster hvcluster1
Description
———–
Exactly like the previous example, using named parameters.
.LINK
http://www.altaro.com/hyper-v/powershell-script-hyper-v-get-clustervm/
#>
#requires -Version 3
#requires -Modules Hyper-V, FailoverClusters
[CmdletBinding()]
param(
[Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelinebyPropertyName=$true)]
[Alias(“Name”, “VM”)]
[String[]]$VMName = @(),
[Parameter(Position=1, ValueFromPipeline=$true, ValueFromPipelinebyPropertyName=$true)]
[Alias(“ComputerName”, “ClusterName” , “HostName”, “VMHost”)]
[PSObject]$Cluster = $env:COMPUTERNAME
)
BEGIN {}
PROCESS {
Set-StrictMode -Version Latest
# Convert input to a string
switch( $Cluster.GetType().Name)
{
“Cluster” {
$Cluster = $Cluster.Name
}
“VMHost” {
$Cluster = $Cluster.Name
}
default {
$Cluster = [String]$Cluster
}
}
<# Legend for following script #
1. Retrieve a list of cluster resources of type “Virtual Machine”
2. Extract the computer name of the owner node and the VMId from 1.
3. Use each node and ID set from 2. as Get-VM parameters
4. Did the user specify one or more VMs?
4yes. Retrieve only those from 3.
4no. Allow all VMs to be retrieved from 3.
5. Leave the VMs retrieved in 4. in the pipeline
#>
Get-ClusterResource -Cluster $Cluster | where { $_.ResourceType -like “Virtual Machine” } | #1.
select -Property OwnerNode, @{
Name =”VmID”;Expression ={ (Get-ClusterParameter -InputObject $_ | where { $_.Name -eq “VmID” } | select -Property Value).Value } # 2.
} |
foreach { Get-VM -ID $_.VmID -ComputerName $_.OwnerNode } | # 3.
Where-Object {
if($VMName.Count -gt 0) # 4.
{
$VMName -contains $_.Name # 4yes.
}
else
{ 1 } # 4No.
}
# 5.
}
END {}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s