You are browsing the archive for Windows 8.1.

Run multiple OSs together with Client Hyper-V and use the hosts Wi-Fi adapter for Internet connection

3:10 pm in Client Hyper-V, PowerShell, Wi-Fi, Windows 10, Windows 7, Windows 8.1, Windows XP by Wim Matthyssen

Hi all,

This is a follow up and enhancement to my previous blog post “Use Client Hyper-V and a shared Wi-Fi connection to run Windows 8.1 and Windows 10 Technical Preview simultaneous”, which you can find here: http://scug.be/wim/2015/04/20/use-client-hyper-v-and-a-shared-wi-fi-connection-to-run-windows-8-1-and-windows-10-technical-preview-simultaneous-2/

In this previous post, I set up a Windows 10 virtual machine (VM) on my Dell notebook running Windows 8.1 with Client Hyper-V. But why stop with just two Client Operating System (OS) running together? Therefore, I will show you how to automate an environment in which you can run multiple OSs (Windows 8.1, Windows 10 Technical Preview, Windows 7 with SP1 and finally Windows XP with SP3) using your notebooks Wi-Fi adapter to connect them to the Internet. If you’re an IT Pro or a software developer and need to do some testing, this is an easy way to do it.

I’ve you’re reading this I assume that you have already installed Client Hyper-V and added the necessary virtual networks, if not just follow steps 1 to 9 in my previous post.

Before starting some important remarks and tips:

  • Windows XP isn’t compatible with Hyper-V’s synthetic network adapter. As such, we will also need to do add a legacy network adapter for the sharing network.
  • Windows XP is not supported by Hyper-V’s Dynamic Memory feature, so we’ll need to use static memory instead.
  • Only W10 TP has the necessary Integration Services on board, that’s why after the OS installation, we will need to install them to the W7 and XP VM.
  • Before installation of the Integration Services in the Windows XP VM, you need to release the mouse and keyboard focus from the VM Connection window by pressing CTRL + ALT + LEFT ARROW.
  • The computer name of the W7 and XP VM is added when you install the OS. In my example I used W7-TST and XP-TST.
  • As a final remark, if you’ve installed the Windows 7 VM without SP1 you will receive the below error when trying to install the Integration Services.

clip_image001

1) For the automated built of the 3 VMs run the below PowerShell script. All virtual hardware will be added and configured and the OS ISO’s will be mounted. At the end the VMs will be started up to begin the OS installations. Please be aware that in order to us your shared Wi-Fi connection, the “InternalWifi” virtual switch needs to be attached to a legacy network adapter.

#----------------------------------------

#Author Wim Matthyssen

#Date 06/05/15

#Name BuiltClientOSVMs.ps1

#Usage Built several Client OSs VMs on Client Hyper-V

#Note Change variables were needed to fit your needs

#----------------------------------------

# Variables

$VM1 = "W10-TST" # Name of Windows 10 VM

$VM2 = "W7-TST" # Name of Windows 7 VM

$VM3 = "XP-TST" # Name of Windows XP VM

$VMRAMMIN = 512MB # Minimum RAM assigned to the VM

$VMRAMSTARTUP = 2GB # Startup RAM assigned to the VM

$VMRAMMAX = 4GB # Maximum RAM assigned to the VM

$VHDSIZE = 20GB # Size of fixed VHDX

$VMLOC = "D:\_VM" # Location of the VM and VHDX files

$NetworkSwitch1 = "InternalWifi" # Name of the Network Switch 1

$NetworkSwitch2 = "InternalShare" # Name of the Network Switch 2

$vCPUCOUNT=2 #Number of virtual CPUs

$W10ISO = "D:\Documents\Windows10_TP.iso" # Windows 10 ISO

$W7ISO = "D:\Documents\Windows7_SP1.iso" # Windows 7 with SP1 ISO

$XPISO = "D:\Documents\WindowsXP_SP3.iso" # Windows XP with SP3 ISO


# Create Windows 10 VM - Add Networks - Mount ISO

New-VHD –Path $VMLOC\$VM1\$VM1.vhdx –Fixed –SizeBytes $VHDSIZE

New-VM –Name $VM1 –Path $VMLOC

Add-VMHardDiskDrive -VMName $VM1 -Path $VMLOC\$VM1\$VM1.vhdx

Set-VMMemory $VM1 -DynamicMemoryEnabled $true -MinimumBytes $VMRAMMIN -StartupBytes $VMRAMSTARTUP -MaximumBytes $VMRAMMAX -Priority 80 -Buffer 25

Set-VMProcessor $VM1 –Count $vCPUCOUNT

Get-VMNetworkAdapter $VM1| Connect-VMNetworkAdapter –SwitchName $NetworkSwitch2

Get-VM $VM1 | Add-VMNetworkAdapter -IsLegacy $true -SwitchName $NetworkSwitch1

Set-VMDvdDrive -VMName $VM1 -Path $W10ISO

Start-VM $VM1


# Create Windows 7 VM - Add Networks - Mount ISO

New-VHD –Path $VMLOC\$VM2\$VM2.vhdx –Fixed –SizeBytes $VHDSIZE

New-VM –Name $VM2 –Path $VMLOC

Add-VMHardDiskDrive -VMName $VM2 -Path $VMLOC\$VM2\$VM2.vhdx

Set-VMMemory $VM2 -DynamicMemoryEnabled $true -MinimumBytes $VMRAMMIN -StartupBytes $VMRAMSTARTUP -MaximumBytes $VMRAMMAX -Priority 80 -Buffer 25

Set-VMProcessor $VM2 –Count $vCPUCOUNT

Get-VMNetworkAdapter $VM2| Connect-VMNetworkAdapter –SwitchName $NetworkSwitch2

Get-VM $VM2 | Add-VMNetworkAdapter -IsLegacy $true -SwitchName $NetworkSwitch1

Set-VMDvdDrive -VMName $VM2 -Path $W7ISO

Start-VM $VM2


# Create Windows XP VM - Add Networks - Mount ISO

New-VHD –Path $VMLOC\$VM3\$VM3.vhdx –Fixed –SizeBytes $VHDSIZE

New-VM –Name $VM3 –Path $VMLOC

Add-VMHardDiskDrive -VMName $VM3 -Path $VMLOC\$VM3\$VM3.vhdx

Set-VM -StaticMemory -Name $VM3 -MemoryStartupBytes 2GB

Set-VMProcessor $VM3 –Count $vCPUCOUNT

Remove-VMNetworkAdapter -VMName $VM3

Get-VM $VM3 | Add-VMNetworkAdapter -IsLegacy $true -SwitchName $NetworkSwitch2

Get-VM $VM3 | Add-VMNetworkAdapter -IsLegacy $true -SwitchName $NetworkSwitch1

Set-VMDvdDrive -VMName $VM3 -Path $XPISO

Start-VM $VM3

2) When you’re done installing the guest OSs, logon to your 3 new VMs.

3) Insert the Integration Services Setup disk to the W7 and XP VM.

clip_image003

4) On both VMs, if the installation doesn’t start automatically, open a command prompt and run d:\support\x86\setup.exe and select “Yes” to start the installation. When the Upgrade Hyper-V Integration Services box appears click “OK”. To complete the installation press “Yes” to reboot.

clip_image005

clip_image006

5) To check the version of the Integration Services through Device Manager, expand System Devices, right click Microsoft Hyper-V Virtual Machine Bus, and select Properties. Click the Driver tab and the Driver Version line will show you the version you’re running.

clip_image007

6) To prepare your host to connect to the shared folders and do the rest of the configuration for the W10 VM you can now follow steps 12 to 18 from my previous post.

7) To rename the network adapters for the W7 VM, logon, open a command prompt and run the following commands:

netsh interface set interface name = "Local Area Connection" newname = "WiFi"
netsh interface set interface name = "Local Area Connection 2" newname = "Sharing"

8) Logon to the XP to rename the network adapters. Open a command prompt and run the following commands:

netsh interface set interface name = "Local Area Connection" newname = "Sharing"
netsh interface set interface name = "Local Area Connection 2" newname = "Wifi"

9) On the W7 VM assign the fixed IP Address 33.0.0.3 for the “Sharing” network adapter from the command prompt (requires elevation).

netsh interface ip set address name = "Sharing" static 33.0.0.3 255.255.255.0

clip_image002[4]

10) On the XP VM assign the fixed IP Address 33.0.0.4 for the “Sharing” network adapter from the command prompt.

netsh interface ip set address name = "Sharing" static 33.0.0.4 255.255.255.0

clip_image004[4]

11) To share and to create the Temp folder on the W7 VM open a command prompt and run the following commands (requires elevation):

md C:\Temp
net share Temp=C:\Temp /GRANT:Everyone,Full

clip_image006[4]

12) To share and to create the Temp folder on the XP VM open a command prompt and run the following commands:

net user guest /active:yes
md C:\Temp
net share Temp=C:\Temp /unlimited

clip_image008[4]

13) To map the Temp folders from the 3 VMs on the host to the X, Y and Z-drive run the following commands in PowerShell (do not run PowerShell as an administrator)

New-PSDrive –Name X –PSProvider FileSystem –Root “\\W7-TST\Temp” –Persist -Credential W7-TST\username
New-PSDrive –Name Y –PSProvider FileSystem –Root “\\W10-TST\Temp” –Persist -Credential W10-TST\username
New-PSDrive –Name Z –PSProvider FileSystem –Root “\\xp-tst\Temp” –Persist -Credential XP-TST\username

clip_image010[4]

clip_image011[4]

14) As you can see in the below screenshot I’m able to surf with all OSs and share data between them.

clip_image013[6]

This concludes this blog post. Keep tuned and I’ll be back soon.

Use Client Hyper-V and a shared Wi-Fi connection to run Windows 8.1 and Windows 10 Technical Preview simultaneous

11:22 am in Client Hyper-V, PowerShell, Wi-Fi, Windows 10, Windows 8.1 by Wim Matthyssen

With the official release of Windows 10 in the pipeline somewhere this summer, I wanted to play around with the Windows 10 Technical Preview (WTP). My idea was to use Client Hyper-V on my Dell notebook, running Windows 8.1, and build a virtual machine (VM) with the latest W10 WTP build (9926) on top of it. In this way, I could run both operating systems (OSs) together on the same desktop and see all what is changed.

The above set-up will allow me to test the new Windows 10 features (such as the new browser Project Spartan, Cortana, Continuum, the new start menu and lots of other nice improvements). Upon that, I will still be able to do some productive work on my Windows 8.1

Please note if you want to download the latest W10 WTP you need to join the Windows Insider program. You can become a member via the following link: https://insider.windows.com/. Just press the “Get Started” button and follow the procedure. If everything is filled in and confirmed, you can download the WTP of this bright new OS.

But enough said it’s time to get our fingers wet and get everything up and running. Like mentioned above, I will walk you through the different steps I followed to run both OSs simultaneous. Both of them will be able to access the Internet with use of a Wi-Fi connection and you can share data from your VM to your host and vice versa.

In order to understand the following steps in a good way, please note that with host the Windows 8.1 is meant.

Step 1 is installing Client Hyper-V as this feature is not installed by default. First check if your notebook or desktop meets the necessary hardware and system requirements:

  • Windows 8.1 Pro or Enterprise 64 bit OS
  • 64-bit processor that has Second Level Address Translation (SLAT)
  • 4 GB of RAM
  • BIOS-level Hardware Virtualization support enabled

If all is good you are ready to go.

1) Open up a PowerShell window with administrator permissions on your host and run the following command

enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V –All

2) Type “Y” to restart your computer

clip_image002

clip_image004

Since I’m working on my notebook I want to use my onboard wireless adapter to get the VM connected to the Internet. Client Hyper-V can’t automatically use your Wi-Fi adapter so you need to use a little workaround to get this working. Therefore I will create two internal virtual switches in the next step. One is to use your wireless card and the other one will be used in a later step to share data between your host and your VM.

3) Open up PowerShell again with administrator permissions and run the following commands:

New-VMSwitch -Name InternalWifi -SwitchType Internal -Notes 'Share Parent Wifi'
New-VMSwitch -Name InternalShare -SwitchType Internal -Notes 'Sharing network'

image

4) You can check if both are created correctly by opening up your Hyper-V Manager and click on Virtual Switch Manager

image

5) Next open Network and Sharing Center on the host and choose Change adapter settings

6) Select the Wi-Fi adapter and choose Properties

clip_image010

7) In the Properties window, click the Sharing tab

8) Check the “Allow other network user to connect through this computer’s Internet connection” box, select “vEthernet (InternalWifi)” and click OK to close the window

clip_image012

9) If all is setup correctly you should see the word Shared beside your wireless connection

clip_image014

10) Run the below PowerShell script for an automated built of the W10 VM with all necessary virtual hardware installed and configured. Also the W10 ISO is connected and the VM will be started up to install the OS. It might be possible that you need the change some variables like the location and name of the ISO while running this script. Please be aware that in order to us your shared Wi-Fi connection, the “InternalWifi” virtual switch needs to be attached to a legacy network adapter.

#-------------------------------------------------------------------
#Author: Wim Matthyssen
#Date: 14/04/15
#Name: BuiltW10VM.ps1
#Version: 1.0
#Note: Change variables were needed to fit your environment
#-------------------------------------------------------------------

# Variables
$VM = "W10-TST" # Name of VM
$VMRAMMIN = 512MB # Minimum RAM assigned to the VM
$VMRAMSTARTUP = 2GB # Startup RAM assigned to the VM
$VMRAMMAX = 4GB # Maximum RAM assigned to the VM
$VHDSIZE = 40GB # Size of fixed VHDX
$VMLOC = "D:\_VM" # Location of the VM and VHDX files
$NetworkSwitch1 = "InternalWifi" # Name of the Network Switch 1
$NetworkSwitch2 = "InternalShare" # Name of the Network Switch 2
$vCPUCOUNT=2 #Number of virtual CPUs
$W10ISO = "D:\Documents\Windows10_TP.iso" # Windows 10 ISO

# Create VM
New-VHD –Path $VMLOC\$VM\$VM.vhdx –Fixed –SizeBytes $VHDSIZE
New-VM –Name $VM –Path $VMLOC
Add-VMHardDiskDrive -VMName $VM -Path $VMLOC\$VM\$VM.vhdx
Set-VMMemory $VM -DynamicMemoryEnabled $true -MinimumBytes $VMRAMMIN -StartupBytes $VMRAMSTARTUP -MaximumBytes $VMRAMMAX -Priority 80 -Buffer 25
Set-VMProcessor $VM –Count $vCPUCOUNT

# Add Networks
Get-VMNetworkAdapter $VM| Connect-VMNetworkAdapter –SwitchName $NetworkSwitch2
Get-VM $VM | Add-VMNetworkAdapter -IsLegacy $true -SwitchName $NetworkSwitch1

# Mount ISO
Set-VMDvdDrive -VMName $VM -Path $W10ISO

Start-VM $VM

image

11) Install the guest OS and if all went good, logon for the first time to your WTP of W10

12) When logged on, rename the computer with the following PowerShell commands (requires admin rights)

Rename-Computer –NewName “W10-TST”
Restart-Computer

13) When the VM is restarted, logon and rename the network adapters via PowerShell (requires admin rights)

Get-NetAdapter -Name Ethernet | Rename-NetAdapter -NewName WiFi –PassThru
Get-NetAdapter -Name “Ethernet 2” | Rename-NetAdapter -NewName Sharing –PassThru

image

14) Assign the fixed IP Address 33.0.0.2 for the “Sharing” network adapter with use of PowerShell (requires admin rights) on the VM

#Retrieve the right network adapter
$netadapter = Get-NetAdapter -Name Sharing

#Disable DHCP
$netadapter | Set-NetIPInterface -DHCP Disabled

# Configure the IP addres
$netadapter | New-NetIPAddress -AddressFamily IPv4 -IPAddress 33.0.0.2 -PrefixLength 24 -Type Unicast

image

15) You can check if the IP Address is set correctly by running ipconfig

image

16) Now on the host, assign the static IP address 33.0.0.100 to the network adapter that was created for the virtual switch “InternalShare”. Open up PowerShell (requires admin rights) and run following commands

#Retrieve the right network adapter
$netadapter = Get-NetAdapter -Name “vEthernet (InternalShare)”

#Disable DHCP
$netadapter | Set-NetIPInterface -DHCP Disabled

# Configure the IP addres
$netadapter | New-NetIPAddress -AddressFamily IPv4 -IPAddress 33.0.0.100 -PrefixLength 24 -Type Unicast

image

17) To share and to create the Temp folder on the VM do the following:

#Create the Temp folder on the C-drive
New-Item -Path C:\Temp -ItemType directory

#Share the Temp folder
New-SmbShare -Name Temp -Path c:\Temp –FullAccess “EVERYONE”

image

18) To map the Temp folder from the VM on the host to the Z-drive run the following command in PowerShell (do not run PowerShell as an administrator)

New-PSDrive –Name Z –PSProvider FileSystem –Root “\\W10-TST\Temp” –Persist -Credential W10-TST\username

image

As you can see in the below screenshot I’m able to surf with both OSs and share data between them.

image

This concludes this blog post. Keep tuned and I’ll be back soon.

Wim Matthyssen (@wmatthyssen)