Build a Hyper-V Server 2012 or Windows Server 2012 with Hyper-V from the command line including Server Core network configuration, whether it be PowerShell or Command Prompt. Please note, this roughly covers configurations for both a single server with a single NIC, and a server to be used in a failover cluster using several NICs including iSCSI. These are not an exact order of steps to follow, but more so my notes that I use when building a server which I follow roughly. So a fairly good technical knowledge is needed to follow and understand this. I have included a large diagram on this page which should help you understand the new Hyper-V virtual extensible switch. Even if you don’t intend to run virtual machines on top of Hyper-V, you would still need the Hyper-V role to be installed to give you a whole new range of cool virtual network options that you never got before. Most of the PowerShell network cmdlets below require the Hyper-V role to be installed, as not only Hyper-V provides a virtual machine solution, but also a really good virtual network solution as well.
- In front of the server
To start with, there are several steps that need to be done from the console in front of the server. To open this blue box on Server Core, run sconfig from the command prompt.
- Remote Management needs to be configured.
- Select option 4
- Select all options, 1 and 3.
- Enable Remote Desktop
To allowing for older clients, run the following command:
cscript C:\Windows\System32\Scregedit.wsf /ar 0
- Install the Hyper-V role
This is only if needed. Run the following cmdlet.
Add-WindowsFeature Hyper-V -Restart
- NIC Teaming
To setup NIC Teaming on the server:
- Run the following command from PowerShell to see a list of all network adapters
Get-NetAdapter
- Run the following command to setup a new NIC Team:
New-NetLbfoTeam –Name Team1 –TeamMembers NIC1,NIC2
- Configures the NIC Teaming mode
Set-NetLbfoTeam -Name Team1 –TeamingMode SwitchIndependent
The setting SwitchIndependent Specifies that a network switch configuration is not needed for the NIC team. Because the network switch is not configured to know about the NIC teaming, the team members can be connected to different switches.
- Create a Hyper-V Extensible switch
Hyper-V switches have a one-to-one relationship with a physical NIC, whether it be a teamed NIC or an individual NIC.
New-VMSwitch -Name VMNET -NetAdapterName 1G -AllowManagementOS $False -MinimumBandwidthMode Weight
Hyper-V extensible switch, converged networks
- Virtual NICs
Create host level virtual NICs for each desired VLAN. This is more so for the purpose of a Windows failover cluster where many host networks are required. These vNICs will hang off the vSwitch you created in the previous step. Please note, as the vSwitch will be tied to a physical NIC and in turn connected to a physical port on a switch, this switch would need to be trunked with the relevant VLANs required. Each vNIC can have only one VLAN ID associated with it.
- Create the vNIC and assign it to the VMNET vSwitch:
Add-VMNetworkAdapter -ManagementOS -Name "Management" -SwitchName "VMNET"
- Assign a VLAN ID to the vNIC:
Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "Management" -Access -VlanId 10
- Assign the MinimumBandwidthWeight. This guaranties a bandwidth that is available on the virtual network adapter in relation to the other adapters. The weight value for all NICs must add up to 100, as this is a percentage.
Set-VMNetworkAdapter -ManagementOS -Name "Management" -MinimumBandwidthWeight 30
- Configure VLAN IDs
Configure VLAN ID directly on the physical network connection if required.
- Run the following command from PowerShell to see a list of all network adapters:
Get-NetAdapter
- Run the following command to configure the VLAN ID:
Set-NetAdapter –Name "Ethernet 1" -VlanID 10
- IP Addresses
Configure IP Address for the server
- Select Option 8
- Windows Firewall
Disable Windows Firewall. From the command prompt or by using PowerShell, run the following command:
- From the command line
netsh advfirewall set allprofiles state off
- Using Powershell
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
- Hostname
Give the server a name:
- Select option 2
Then reboot
- Remote Server configuration
The rest of the configuration can be done from another computer remotely via a remote desktop connection.
- Windows Time and Date
- From the command prompt, run the following commands:
sc config w32time start= auto
net start w32time
- Open the Date and Time GUI by running the following command:
Control timedate.cpl
- DNS suffix
- Run the following PowerShell command to set the correct Domain and SearchList REG_SZ entries.
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" Domain -Value dc.local –Force
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" SearchList -Value dc.local –Force
- DNS Registration
If you don’t want DNS registration of an IP address to occur, then when setting the primary or secondary DNS address, add Register=None to the end.
- Run the following to see a list of network interfaces:
netsh interface ipv4 show interfaces
-
Configure the Primary DNS address while disabling DNS registration
netsh interface ipv4 add dnsserver "Local Area Connection" address=<IP address of the primary DNS server> index=1 Register=None
-
Configure the Secondary DNS address while disabling DNS registration
netsh interface ipv4 add dnsserver "Local Area Connection" address=<IP address of the secondary DNS server> index=2 Register=None
- Disable IPv6
This is for all servers that don’t require IPv6. More info here.
- Run the following PowerShell command to disable IPv6:
New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\services\TCPIP6\Parameters -Name DisabledComponents -PropertyType DWord -Value 0xffffffff
- Disable NetBIOS over TCP/IP
- Run the following command to get a list of interfaces on the machine
wmic nicconfig get caption,index,TcpipNetbiosOptions
-
Take note of the index number for the adapter that you want to disable NetBIOS over TCP/IP. Then run the following.
wmic nicconfig where index=1 call SetTcpipNetbios 2
SetTcpopNetbios options:
0 – Use NetBIOS setting from the DHCP server
1 – Enable NetBIOS over TCP/IP
2 – Disable NetBIOS over TCP/IP
- SMB2 share connections
When connecting to SMB2 based shares, you might receive an error "An unexpected network error occurred" Run the following PowerShell cmdlet to allow the server to connect to SMB2 based shares.
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" RequireSecureNegotiate -Value 0 –Force
http://support.microsoft.com/kb/2686098
- File and Print Sharing
File and Printer Sharing should be disabled for NICs relating to iSCSI
Use a utility called NVSPbind to clean up protocols on an adaptor, disable File and Print sharing. Also to change the binding order of network adaptors:
ms_netbios (NetBIOS Interface)
ms_netbios (NetBIOS Interface)
ms_server (File and Printer Sharing for Microsoft Networks)
ms_server (File and Printer Sharing for Microsoft Networks)
ms_pacer (QoS Packet Scheduler)
ms_msclient (Client for Microsoft Networks)
ms_msclient (Client for Microsoft Networks)
ms_lltdio (Link-Layer Topology Discovery Mapper I/O Driver)
ms_rspndr (Link-Layer Topology Discovery Responder)
ms_tcpip6 (Internet Protocol Version 6 (TCP/IPv6))
ms_netbt (WINS Client(TCP/IP) Protocol)
ms_netbt (WINS Client(TCP/IP) Protocol)
ms_smb (Microsoft NetbiosSmb)
ms_smb (Microsoft NetbiosSmb)
ms_tcpip (Internet Protocol Version 4 (TCP/IPv4))
- Download NVSPbind from http://archive.msdn.microsoft.com/nvspbind/ Copy to the local machine, then from the command prompt, run nvspbind with no switches. This will list all your adaptors and the protocols enabled or disabled.
For example, to disable a protocol on an adaptor, use the switch /d to disable binding of specified protocol from specified nic(s). If we were to disable File and Printer Sharing for Microsoft Networks for adaptor {913D8F46-BFC7-4359-A024-90485C276984}, then we would type in:
nvspbind –d {913D8F46-BFC7-4359-A024-90485C276984} ms_server
- To see the current order of adaptors, type in:
nvspbind /o ms_tcpip
To change the order of an adaptor, to move an adaptor right to the top, type in:
nvspbind /++ "Local Area Connection" ms_tcpip
- Windows Updates
Download and install Windows Updates
- Select Option 6
- Additional Drives
Connect remotely to the server using a computer management console, then configure any additional drives
The HP Array Configuration Utility can be setup on the server by running C:\Program Files (x86)\Compaq\Cpqacuxe\Bin\setup.exe from the command line. Select Remote mode.
Then remotely, the HP ACU can be accessed by navigating to https://<ServerName>:2381/ACU-XE/ACU.htm
- Virtual memory/paging file
Configuring the Paging File on Windows Server Core or Hyper-V Server 2012 R2 can be difficult, as this needs to be done via the command prompt.
- To check the current paging file configuration, check the registry HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management or run the following:
wmic pagefile list /format:list
- Turn off automatic paging files
wmic computersystem where name="%computername%" set AutomaticManagedPagefile=False
- Create a new paging file on a separate drive
wmic.exe pagefileset create name="S:\pagefile.sys"
- Manually configure the new paging file
wmic.exe pagefileset where name="S:\\pagefile.sys" set InitialSize=64509,MaximumSize=65000
- Delete the default C:\ drive paging file
wmic.exe pagefileset where name="C:\\pagefile.sys" delete
- Configuration for Remote Machine connection
Configuration steps from the management machine, so that you can connect successfully to the non-GUI server.
-
If the server is not a member of the domain, add server credentials to the remote machine, so that remote connections will be seamless by not asking for credentials
- Run the following command:
cmdkey /add:<ServerName> /user: <ServerName>\<UserName> /pass:<password>
- Run the following command:
- On the remote computer, add the Hyper-V server as a trusted host with the following Windows PowerShell cmdlet:
Set-Item WSMan:\localhost\Client\TrustedHosts -Value <RemoteServerName> -Concatenate
-
Edit DCOM security on the remote machine to allow for Remote Access
- Click Start > Run > open DCOMCNFG
- Browse through to: "Component Services > Computers > My Computer"
- Open Properties for My Computer and select the COM Security tab
- In Access Permissions area click the Edit Limits button
- Select the Anonymous Logon group and make sure the Remote Access is set to Allowed
great manual man!
I’m currently rebuilding our 2008r2 cluster to 2012 and your post helped me very much.
Thx for sharing.
Grtz from Holland ;-)
Thanks very much for sharing. I’m currently installing the Server 2012 Hyper-V on a test machine that your writing helps me a lot.
[…] Hyper-V PS cmdlets essential samples […]
This is by far the best write up I have found on how to make the GUI-less 2012 work. Still complicated and time consuming but very nice. If you want to go back to GUI then try vtutilities from VT technologies $119 US and worth it at 3 times the price. Also I have written a blog outlining like you how to make the most of Core Server 2012. Stephanco.blogspot.com, I tell you how to to get a GUI start menu of sorts and other sweet work arounds to make you more productive faster using core server 2012.
Great mannual . I have configured Hyper-V 2012 on a laptop and deployed WIndows 2012 to set up VDI .
Many thanks from Russia!!!
Was a big problem with remote control by mmc – DCOM options helped!
Great information. Lucky me I ran across your site by
accident (stumbleupon). I’ve bookmarked it for later!
Hello would you mind letting me know which web host you’re working with? I’ve loaded your blog in 3 different internet browsers and I must say this blog loads a lot faster then most.
Can you suggest a good web hosting provider at a honest price?
Thanks, I appreciate it!
Excellent way of describing, and fastidious post to obtain information concerning my presentation focus,
which i am going to deliver in school.
Wow. I spent a lot of money and energy to figure out what your graphic very clearly illustrates. Thanks!!
Wonderful article! We will be linking to this great article on our website.
Keep up the great writing.
Hi,
What is the opposite to your disable IPV6 command please? I need to re-enable.
Thank you
This should reverse the registry change to effectively re-enable IPv6
Remove-ItemProperty -path HKLM:\SYSTEM\CurrentControlSet\services\TCPIP6\Parameters -Name DisabledComponents
Perfect, thank you for immediate response. After making that change, I can no longer edit network settings via sconfig.cmd
I ran this on two servers, one came back online with this error (now fixed) the other did not come back online. Well, it is running as the VMs are up, but cannot connect via RDC to the host or by management tools. Any ideas?
Thanks again.
I remember I had the same problem at one stage with exactly that losing access to configure networking from sconfig, but was a long time ago. I had to re-configure the network from the command line to get me back up and running again. I can’t remember exactly the steps, but was basically a case of removing the virtual networks altogether using PowerShell and trying to remove the local adapter network settings completely then starting from scratch – see if this article helps http://www.petri.co.il/configure_tcp_ip_from_cmd.htm
I can now use sconfig after re-enabling IPv6 using your command, its just that the second sever I ran it on cant even be pinged anymore haha. Im working remotely, so I guess theres not much I can do now.
Thanks for the help.
Do you have iLo or DRAC? Save me on numerous occasions. Don’t leave home without it :)
There werent enough network points when installed, new switch is on the way :(
I’ve been there before – sucks when that happens.
Atleast the VM is running, so users can access AD/Files. Cheers for the convo :)
HyperV with VLANID does not work!
Hello, Mark,
I created a nic teaming with 3 network cards and a virtual switch.
My need is to create the following scenario:
– Nic Teaming with 3 network cards
– VEthernet (Live migratory-on) – 1 VLANID
– VEthernet (ClusterHB) – VLANID 2
– VEthernet (Management \ Backup) – VLANID3
I have two switches cascaded in (LinkAgredation / Trun-k).
My server is connected as follows: NIC1: SW1, NIC2: SW2, CIN3: SW1
I asked for support networks configure the switch ports which I will use for my NICs in Trunk.
Here we go:
– I created the Nic Teaming in Independent mode – HyperV-Port
– Created vEthernet (Live migratory-on) – 1 VLANID
– Created vEthernet (ClusterHB) – VLANID 2
– Created vEthernet (Management \ Backup) – VLANID3
My main network I’m connected is in VLANID 3 (172.16.16.50) and try to ping the vEthernet (Managment \ B-ackup) – VLANID3 that has the IP: 172.16.16.60 does not work.
I removed the NIC Teaming and put the IP: 172.16.16.60 on each (NIC1, NIC2, CIN3) to verify if there was any problem in the SW configuration, but the ping worked normally.
The problem only occurs after creating the nic teaming.
PS1: I put the IP: 172.16.16.60 directly in the Nic Teaming driver, I type changes Nic Teaming for static and not funciounou too.
PS2: I created a second nic teaming, as your blog and assigns putting VLANID3 and neither worked an IP.
What am I doing wrong?
Thank you….HyperV with VLANID does not work!
Hello, Mark,
I created a nic teaming with 3 network cards and a virtual switch.
My need is to create the following scenario:
– Nic Teaming with 3 network cards
– VEthernet (Live migratory-on) – 1 VLANID
– VEthernet (ClusterHB) – VLANID 2
– VEthernet (Management \ Backup) – VLANID3
I have two switches cascaded in (LinkAgredation / Trun-k).
My server is connected as follows: NIC1: SW1, NIC2: SW2, CIN3: SW1
I asked for support networks configure the switch ports which I will use for my NICs in Trunk.
Here we go:
– I created the Nic Teaming in Independent mode – HyperV-Port
– Created vEthernet (Live migratory-on) – 1 VLANID
– Created vEthernet (ClusterHB) – VLANID 2
– Created vEthernet (Management \ Backup) – VLANID3
My main network I’m connected is in VLANID 3 (172.16.16.50) and try to ping the vEthernet (Managment \ B-ackup) – VLANID3 that has the IP: 172.16.16.60 does not work.
I removed the NIC Teaming and put the IP: 172.16.16.60 on each (NIC1, NIC2, CIN3) to verify if there was any problem in the SW configuration, but the ping worked normally.
The problem only occurs after creating the nic teaming.
PS1: I put the IP: 172.16.16.60 directly in the Nic Teaming driver, I type changes Nic Teaming for static and not funciounou too.
PS2: I created a second nic teaming, as your blog and assigns putting VLANID3 and neither worked an IP.
What am I doing wrong?
Thank you
Spot on with this write-up, I absolutely feel this web site needs much more attention.
I’ll probably be back again to read through more,
thanks for the information!
You’re truly a just right webmaster. The web site loading pace is incredible. It sort of feels that you’re doing any distinctive trick. Also, The contents are masterwork. you have done a excellent process on this matter!
Amazing blog! Do you have any helpful hints for aspiring
writers? I’m hoping to start my own site soon but I’m
a little lost on everything. Would you suggest starting with a free platform like WordPress or go for a paid option? There are so many choices out
there that I’m completely overwhelmed .. Any recommendations?
Kudos!
hello there and thank you for your information – I’ve certainly picked up anything new
from right here. I did however expertise several technical issues using this website, since I experienced to reload the
site lots of times previous to I could get it to load properly.
I had been wondering if your web hosting is OK? Not that I’m
complaining, but slow loading instances times will sometimes
affect your placement in google and could damage your high quality score if advertising and
marketing with Adwords. Well I am adding this RSS to my email and
can look out for a lot more of your respective intriguing content.
Ensure that you update this again soon.
I do consider all of the concepts you’ve presented
on your post. They are really convincing and can certainly work.
Nonetheless, the posts are very brief for novices. May just you please prolong
them a little from next time? Thank you for the post.
Appreciation to my father who told me about this website, this website is genuinely
awesome.
Great blog here! Also your site loads up fast! What host
are you using? Can I get your affiliate link to your host?
I wish my website loaded up as quickly as yours lol
I’m very happy to find this site. I wanted to thank you for your time for this particularly wonderful read!!
I definitely really liked every part of it
and i also have you bookmarked to look at new things in your blog.
magnificent issues altogether, you simply gained a new reader.
What may you suggest in regards to your post
that you made some days in the past? Any sure?
Hey! I know this is kinda off topic however I’d figured I’d ask.
Would you be interested in trading links or maybe guest writing a blog article or vice-versa?
My website discusses a lot of the same subjects as yours
and I believe we could greatly benefit from each other.
If you’re interested feel free to shoot me an e-mail. I look forward to hearing from you!
Great blog by the way!
Wow, amazing blog format! How long have you been running a blog
for? you made running a blog look easy. The total look of your site is fantastic, let alone
the content material!
Awesome publications and type of blogging.
I do believe I’ll come back on this site at a later time and see precisely what else you’ve gotten in store!
;-) I’m heading to view if my hubby and I can potentially come across anything at all concerning
cleaning tips for home!!
xe fiat albea 2008
Windows Server 2012 Hyper-V server command line configuration | Marc Kean
sieu xe audi
Windows Server 2012 Hyper-V server command line configuration | Marc Kean
xe ford co tot khong
Windows Server 2012 Hyper-V server command line configuration | Marc Kean
[…] Windows Server 2012 Hyper-V server command line … – Sep 26, 2012 · Build a Hyper-V Server 2012 or Windows Server 2012 with Hyper-V from the command line including Server Core network configuration, whether it be …… […]
Its a Awesome fucking Tuto!! It’s perfectelly! Woks Very, Very good!
news
Windows Server 2012 Hyper-V server command line configuration | Marc Kean