Programming and Technology blog

Hyper-V - "Video Remoting Was Disconnected" Error

Started to get the error "Video Remoting Was Disconnected" when connecting to a Hyper-V VM using the Admin Console on a local machine (Connecting to the VM via RDP worked fine). All of the more relevant fixes talk about changing the settings on the NIC card which seemed a bit far fetched however I tried them all and none work.

First off my config.

  • Windows 10 device connected to an AD domain
  • My domain login account has domain admin privileges
  • My domain login account is part of the local computers Builtin Administrators group

The problem eventually was solved by resetting the C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys folder permissions using the following commands

md c:\temp

icacls C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys /t /c > c:\temp\BeforeScript_permissions.txt

takeown /f "C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys" /a /r

icacls C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys /t /c /grant "NT AUTHORITY\System:(F)"

icacls C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys /t /c /grant "NT AUTHORITY\NETWORK SERVICE:(R)"

icacls C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys /t /c /grant "BUILTIN\Administrators:(F)"

icacls C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys /t /c > c:\temp\AfterScript_permissions.txt

Restart-Service TermService -Force

I also rebooted the machine just in case.

I think that something must have been weird-ed out when I joined the computer to the domain / renamed it or something along those lines.

This is not a definitive way to solve this problem as it was a last attempt to fix the issue when all other suggestions failed. You have been warned! lol

Update to Narayana Vyas Kondreddi's generate insert script for SQL Server 2012

If you are like me you like re-using tools that you find extremely simple and easy to use. That is the case with Narayana Vyas Kondreddi’s sp_generate_inserts script for SQL Server 2000, 2005, (works with 2008 yet not documented). So when I installed SQL Server 2012 developer my first item was to re-create all of the system stored procs I have in my toolbox.

Unfortunately running the script from the above link will generate an error because the code references a system stored procedure that no longer exists in SQL Server 2012 master.dbo.sp_MS_upd_sysobj_category.  This stored procedure toggles the system mode feature where any object created while the mode is enabled is flagged as a system object.  Since the undocumented sproc does not exist the script will be created but it will not work properly.

However there is a small update that can be done to the original script to fix the issue.

You need to remove the following lines

--Turn system object marking on
EXEC master.dbo.sp_MS_upd_sysobj_category 1

And replace the following lines

--Turn system object marking off
EXEC master.dbo.sp_MS_upd_sysobj_category 2


EXEC sys.sp_MS_marksystemobject sp_generate_inserts

The script should ruin without any errors and work as it did in the previous versions.

I have emailed the owner of the script so hopefully he will update the script for 2012.

Some fun at the Winnipeg Code Camp 2012

Overall the Winnipeg Code Camp 2012 did not disappoint, lots of interesting sessions to be found and even more interesting people.

One cool item was: Sam - the Twitter Aware, Arduino Powered, Traffic Light.  Tyler & Jay talk about Sam:

These were the following sessions I took in, each of them offered something different and were quite enjoyable.

  • ASP.NET MVC vs. Ruby on Rails SMACKDOWN - ROUND 2! (Part 1) (Marc Jeanson & James Chambers)
  • ASP.NET MVC vs. Ruby on Rails SMACKDOWN - ROUND 2! (Part 2) (Marc Jeanson & James Chambers)
  • Git 101: Source Control for the Future (David Alpert)
  • Software Craftsmanship Panel Discussion (David Alpert, Amir Barylko, James Chambers, and others!)
  • Illuminated Integration with Team City and Arduino (Tyler Dueck & Jay Smith)

P.S. the winner of the smack down was RoR by a significant margin.  Both sessions and presenters were very informative and dove into the how each framework handles certain features and "how do you do this" in each framework.

Just want to give a big kudos to the organizers and speakers for putting on another successful code camp as well the folks over at Skullspace for hooking up free Wi-Fi for everyone in attendance.

What I have been up to?

Just an update on what I have been up to since my last post. For starters I have been putting in some time helping out with the open source project For the most part I have been doing slot of refactoring and general cleanup of the code base. I have also have been doing some UI standardization to make the UI more consistent across the different sections of the site.

From the site:

BugNET is an open source issue tracking project built using C# and the ASP.NET platform. The main goals are to keep the codebase simple, well documented, easy to deploy and scalable.

It has been interesting helping out on an open source project along with the other developers and I have enjoyed working on it so far. I got started working on it because the company I work for needed a bug tracking system that would us to track bugs/issues as well we wanted clients to be able to enter issues as well. The first thing I did for the project was update the email template engine to use Xml/Xslt to allow for an easier way to generate some of the issue emails that get sent out.

I look forward to doing more work on the project in the New Year as there are some cool ideas on the drawing board for making it even better.

Type 'ContosoUniversity.DAL.Department' could not be found

So I was going through the tutorial Handling Concurrency with the Entity Framework in an ASP.NET MVC Application when I encountered this error on step 7 of 10.

Type 'ContosoUniversity.DAL.Department' could not be found. Make sure that the required schemas are loaded and that the namespaces are imported correctly. Near type name, line 1, column 132.

The error is thrown on the following line:

var databaseValues = (Department)entry.GetDatabaseValues().ToObject();

This error is due to a bug in EF 4.1 where you separate the DAL and Model Entities out into different namespaces and is referenced here EF4.1 CodeFirst - entry.GetDatabaseValues() throw EntitySqlException.

To fix this issue I came up with this workaround:

Replace the lines:

var databaseValues = (Department)entry.GetDatabaseValues().ToObject(); 
var clientValues = (Department)entry.Entity;

with the following lines:

var clientValues = (Department)entry.CurrentValues.Clone().ToObject();
var databaseValues = (Department)entry.CurrentValues.ToObject();

It seems to work ok for simple concurrency checks and it allows you to continue on with the tutorial.