Monday, 29 April 2013

Remotely Connect to Hyper-V with Hyper-V Manager

On Windows 8 or Windows Server 2012 you can install the Hyper-V Management Console and use it to connect to a server or client running Hyper-V Services.

Microsoft has the basic configurations covered at this address;

There is a rather important detail missing though. To connect to the Hyper-V Service running on a different machine, you need to run the Hyper-V Manager using a local account.

Now if you are like me you are thinking to yourself "I am using my local account!" Well you may not be. If you chose to use a Microsoft account when you installed Windows 8, then you are not using a local account.

So make sure you have a local administrative account on both the Hyper-V Server and the Remote Management machine.   Hold down the Shift key and right click the Hyper-V Manager link and select to "Run as different user" and use your local account.

Have a read through the community comments on the bottom of the Technet page for more details.

Wednesday, 24 April 2013

Export Hyper-V Virtual Machine to a File Share in a Workgroup

I have a number of Windows Server 2012 Hyper-V hosts that are not members of a Domain.
To export the Virtual Machines to a File Server we need to authenticate the System service account to the File Server before the Hyper-V Management Service can access the shares. I found this neat trick on Microsoft's Technet Forum which worked wonderfully using PSExec;

1. Open an elevated command prompt: Click start, type CMD, and press Ctrl+Shift+Enter, then accept the UAC dialog (if applicable).

2. Run:
 psexec.exe \\<localServerName> /s cmd.exe
 This will provide you with a new command prompt, but it will instead run under the SYSTEM context, instead of your user context.

3. Run:
 net use \\<remoteServerName>\<sharename> /user:<domain>\<userName> <password>
 This authenticates the SYSTEM account to the share you want to export to.  
 As an example, the line could look like: "net use \\server2\c$ /user:mydomain\Administrator MyAw3s0m3Pwd"

4. Return to the Hyper-V MMC, and try your export again.  It should work now.

5. When you're done, use:
 net use \\<remoteServerName>\<sharename> /delete
 This revokes the credentials from the SYSTEM account.  Alternatively, you could reboot.

6. Type exit, press enter.  You've dropped back to the original command prompt.  Type exit and press enter again, or simply close the window.

This is not a process you would want to perform for a nightly backup, but as a once off it does the trick.


I have been using Linux for a number of years now and right from the start have been using Vim.
It is an elite text editor with a number of inside jokes about it.   Love it or hate it, a skilled Vim operator will out perform any peers on other text editors.   I am not excluding Vi comparable text editors here.

That being said, I am not an expert and this blog post is a repository of commands I am learning and have learned.   I plan on using this page to remind myself of the rarely used commands.   This page will be updated often.

So hear are the commands I am learning or know so far;

%s/foo/bar/g     [Find and Replace foo with bar]
V then =         [Reformat Selection]
n      [After Search Find Next]
v      [Visual Mode]
V      [Visual Mode Line Select]
gg=G   [Re-indent Entire Document]
p      [Put or Paste Buffer]
y      [Yank or Copy Selected]
dd     [Delete the Current Line]
3dd    [Delete Three Lines]
u      [Undo]

Just for reference, here is my vimrc config file;

" Debian Statement
runtime! debian.vim

" Set Syntax and FileType
syntax on
filetype on
filetype indent on
filetype plugin on

" Set Omni completion filetype associations
set ofu=syntaxcomplete#Complete
autocmd FileType html :set omnifunc=htmlcomplete#CompleteTags
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete

" Set Search Format
set incsearch
set ignorecase
set smartcase

" Set Tab Style
set expandtab
set shiftwidth=2
set tabstop=2
set softtabstop=2
set smartindent
set autoindent
set wildmode=longest:full
set wildmenu

" Set Visual Style
set cursorline
hi CursorLine term=none cterm=none ctermbg=3

" Key Maps - Insert Mode
imap ii <C-[>

" Set Environment Values
set nocompatible
set showcmd
set showmatch
set ignorecase
set smartcase
set incsearch
set autowrite
set hidden
set viminfo='100,<100,s10,h

" Enable Terminal Colour Support
if &term =~ "xterm"
set t_Co=256
if has("terminfo")
   let &t_Sf=nr2char(27).'[3%p1%dm'
   let &t_Sb=nr2char(27).'[4%p1%dm'
   let &t_Sf=nr2char(27).'[3%dm'
   let &t_Sb=nr2char(27).'[4%dm'