Changing the Hyper-V Server login experience

Changing the Hyper-V Server login experience

Rate This
  • Comments 6

I have been spending some time working with the free version of Hyper-V server recently (available here: http://www.microsoft.com/en-us/server-cloud/hyper-v-server/default.aspx).  It is lots of fun to see just how much you can do with this free software (hint: you can do everything you can with Hyper-V on a full installation of Windows).

However – one thing that I realized quickly was that I did not like the default login experience.  Normally, when you login to a Hyper-V server you will get a command prompt and a running instance of the Server Configuration tool:

hypervserver1

This is all fine and good when you are first setting the server up.  But after then it gets a bit annoying.  The reality is that most of the time you will be managing Hyper-V remotely – from another Windows computer.  The only reason why you would want to login to a Hyper-V server directly is because something has gone wrong, and you need to do some troubleshooting.

Now, when it comes to troubleshooting a Hyper-V server – there are really only two things I want:

  1. I want to know if all of my virtual machines are okay.
  2. I want a PowerShell window so I can use the Hyper-V cmdlets to dig in deeper if I need to.

Having PowerShell launch by default is quite easy.  Just launch PowerShell from the command prompt (type in “PowerShell” and hit enter) and then run this command:

Set-ItemProperty "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\WinLogon" Shell 'PowerShell.exe -WindowStyle maximized'

Now you will get a PowerShell window instead of a command prompt whenever you login.  But I wanted a bit more than that.  To get a better experience – I needed to create a PowerShell profile.  To create the profile I ran these commands:

Set-ExecutionPolicy RemoteSigned
New-Item -path $profile -type file -force
notepad $profile

And put the following information into the profile file:

# Maximize the window
(Get-Host).UI.RawUI.BufferSize = New-Object System.Management.Automation.Host.Size(((Get-Host).UI.RawUI.MaxPhysicalWindowSize.Width-3),(Get-Host).UI.RawUI.BufferSize.Height)
(Get-Host).UI.RawUI.WindowSize = (Get-Host).UI.RawUI.MaxWindowSize
 
# Get the colors corrected
(Get-Host).UI.RawUI.ForegroundColor = "White"
(Get-Host).UI.RawUI.BackgroundColor = "DarkBlue"
 
# Change path and clear the screen
cd \
cls
 
# Display a welcome message
write-host Welcome to $env:computername
write-host
write-host Current virtual machine status:
get-vm
write-host

The result is that when I login to my Hyper-V server now, I am presented with a full screen PowerShell window and a listing of my virtual machines straight away. Very handy. 

hypervserver2

Cheers,
Ben

Leave a Comment
  • Please add 4 and 2 and type the answer here:
  • Post
  • Ben

    I too have been working with this version and currently i am looking to find a way to install vmworkstation version 9 on this version of server. Can you or do you know of a way to accomplish this? This is for a home lab and would be the best of both worlds to have this ability.

  • wow! great post.

  • John: That's unlikely to be supported. Only one virtualization product can use the hardware virtualization features of the processor at a time, and Hyper-V has already taken them. This is specifically designed as a bare-metal virtualization solution - if you want the ability to install VMware Workstation as well, buy Windows 8.

  • John -

    Mike is correct.  This version of Hyper-V is missing many things (like audio support and DirectX) that VMware workstation will rely upon for functionality.

    Cheers,

    Ben

  • Great post Ben, really helpful!

    Romeo

  • Great post, that's exactly the startup screen I need, too.

Page 1 of 1 (6 items)