Thursday, June 13, 2013

Building a Hyper-v VHost without buying any software $FREE$

Goal: Free core server managed by a GUI environment without Microsoft Hyper-v Manager Software needed and all free (aka no $) and a replacement for vmconnect.

Download it at pshvm.codeplex.com

Here is how to build a vhost and install the software you downloaded

Broad listing of setups steps:
Build your hardware, enable Virtualization in the BIOS
Download the Free hyper-v server file named "HyperV_Server_2012_FREE.ISO"
Burn your ISO to a DVD
Boot to the DVD
Follow the prompts (not many very basic, do google search if have a question)
Choose the language and such then click “Next”:
Click “Install Now”
Next we need to choose which type of Server 2012 installation you want:
There is Core = Free, Standard GUI = paid, Core Standard = No GUI (paid) can be converted to GUI and Standard GUI = Paid
Now we need to agree to the Licensing terms, check the box for “I Accept…” and click “Next”:
Now depending on whether this is an upgrade or fresh install, choose the correct option for you.
For a new install, select “Custom: Install Windows only (advanced)":
If you want to partition the drive click on “Drive Options (advanced)" otherwise click “Next”:
You should now be at the screen where the installation takes place. This takes some time.
Once the server has booted up you will need to provide the default Adminstrator account with a proper password. Click “OK” enter a password twice and then proceed:

Then you will be greeted by SConfig (PS if you accidentally close the SConfig box you can type Sconfig in the DOS prompt and it should load, if not then type logoff in the DOS prompt and you will need to log in again but SConfig will be there for you.)



Choose Option 4 to Configure Remote Management:
a. Enter Selection: 1 to Enable Remote Management
b. Enter Selection: 3 to Allow Remote Machines to Ping server.
Click Yes.

Enter Selection: 4 to Return to Main Menu.
Choose Option 7 to configure Remote Desktop Settings.
a. Type E for (E)nable and press Enter.
b. Enter Selection: 2 to allow any version of Remote Desktop to connect.
You will be returned to the Main Menu.

Choose Option 9 to open the Date and Time GUI.
a. Configure the date and time as you would Server 2008 R2
You will be returned to the Main Menu.

Choose Option 8 to configure Network Settings.
a. It will only list the NICs that are connected to a network.
b. Select the Index# for the adapter you want to configure:
c. You will be shown Current Settings.
Select Option 1 to enter IP Address.
a. Enter S for (S)tatic IP address and press Enter.
b. Enter the new IP Address and press Enter.
c. Press Enter again to accept the default Subnet of /24.
d. Enter the new Static Gateway IP and press Enter.
You will be returned to the Network Adapter Settings Menu.

Select Option 2 to enter DNS IP Addresses.
a. Set the Preferred DNS server IP and press Enter.
 You will get a confirmation Popup. Press OK to continue.
b. Set the Alternate DNS server IP and press Enter.
 You will get a confirmation Popup. Press OK to continue..
You will be returned to the Network Adapter Settings Menu.
c. Select Option 4 to Return to the Main Menu.

In the black CMD/DOS window that is opened by default, type the following in to configure some standard settings: (these are ones I use and recommend) PS no need to install .Net 4.0 as it is already part of the base install.

:Disable TCPChimney
netsh int tcp set global chimney=disabled
:Disable Firewall
netsh advfirewall set allprofiles state off
NOTE: This will allow to RDP and map drives as the firewall is on by default and will prevent you from doing anything remotely until you either turn it off or put in exceptions. I opt to turn it off because I have hardware firewalls.

:Install SNMP-Services (only neeed if you plan on monitoring your VHOST with some monitoring software)
powershell.exe -command "Add-WindowsFeature SNMP-Service"

Choose Option 2 to configure Server Hostname
a. Enter the VHOST hostname and press Enter.
b. You will be prompted to Reboot the server. Click Yes.

ADD THE VHOST TO THE DOMAIN… Not really Needed, but I will show you how.
1. Form the console use the SConfig window.
2. Select Option 1 to Join the VHOST to a Domain.
a. Press D for (D)omain
b. Type the Full Domain and press Enter.
c. Type the Domain Administrator User Name and press Enter.
d. Type the Domain Administrator Password and press Enter.
i. You will be prompted if you want to change the hostname. Click No.
ii. You will be prompted to Restart the machine. Click Yes.

Unzip PSHVM30.zip on your PC then RDP to your VHOST and copy the files to C:\
You can use a thumb drive or create an ISO if you like just get the files to C:\pshvm30

You will have file structure like this
C:\pshvm30
C:\pshvm30\reports
C:\pshvm30\a43

************* you must do it this way or it will not work properly ***********************
at the DOS prompt you get when you login into core server 2012
type
cd\
cd pshvm30
set.bat
install_snmp.bat (only do this one if you will monitor your server with an SNMP enabled monitoring device)
cd a43
a43.exe

Contents of set.bat
Disables the tcp global chimney
netsh int tcp set global chimney=disabled

Contents of install_snmp.bat
powershell.exe -command "Add-WindowsFeature SNMP-Service"
Install the sNMP Service - Mainly used for monitoring etc.


now close the dos prompt that opens when you login and close the sconfig window as well

Browse with the A43 file manager and go to C:\pshvm30\runme.bat and double click it to set these setting and install needed runtime etc.

contents of runme.bat
Turns off the windows firewall
netsh advfirewall set allprofiles state off
Imports needed registry settings
regedit.exe /s C:\pshvm30\autostart.reg
Allows you to run powershell scripts
powershell.exe Set-ExecutionPolicy unrestricted -force
Stops powershell from asking if you really want to run my scripts
powershell.exe dir c:\pshvm30 -Recurse | Unblock-File
Is required for freeRDp to work so you can connect from the server console to a VM
C:\pshvm30\vcredist_x86.exe


to launch PSHVM30 use the shortcut in the A43 file manager or C:\pshvm30\pshvm30.bat

DISCLAIMER:
PSHVM.codeplex.com and James Stephan are not responible for any damage caused to your environment use at your own risk.

* You will need to copy your OS ISO file into the folder C:\iso.

** If you know for a fact that your VM has an IP but when you connect via FreeRDP it stops at the crtl+alt+del screen, you can use the following work arounds below or you just need to install the Microsoft Integration Tools onto your VM so that the powershell script can see the IP it needs to attach too. If you wish to run just wfreerdp.exe you will need to open a DOS prompt, change directory to C:\software and type wfreerdp 192.168.1.10 enter. Wfreerdp.exe does not load a GUI interface like mstsc.exe does you have to tell it via command line what IP you want to connect too.

If your VM's are setup properly you will not need these next steps but they are good to know.

3 comments:

  1. I like all this post it has full of information i like all the idea about all of this .Thanks for this.

    Best regards,
    Liza Curinto
    vps metatrader

    ReplyDelete
  2. How do I send Ctrl-Alt-Del to a VM in FreeRDP?

    ReplyDelete
    Replies
    1. I found it, pressing Ctrl-Alt-End will work.

      Delete