Using Cortana with a fake GPS driver on Windows 10

I’ve mentioned before that I like to offload some of my development and productivity tasks to Virtual Machines running on Microsoft Azure. On these machines I like to run Visual Studio, Office and any other apps I need so I can be productive anywhere.

One of the apps that helps me be productive is Cortana, so I was pleased to get her up and running on my Windows 10 VM.

Cortana can helpfully give you reminders and recommendations based on location, but can you guess what the problem is when using Cortana on a VM in Azure?

Location in Redmond

The location services think I am currently located in Redmond, Washington. Oh dear.

The cross devices functionality of Cortana gets very confused because of this. When I’m using my phone she thinks I’m in Leeds, but if I switch to using the VM she thinks I have suddenly appeared in the United States.

I had a think about how best to approach this issue, and currently I’m trying out a solution which seems to work well: using a homemade Fake GPS driver.

FakeGPS Sensor Driver

I went through the code in the Windows DDK and found an example for creating a GPS driver. Rather than getting the data from a real hardware devices, I hard coded the latitude and longitude. Once I had it set up in exactly the way I wanted, it was just a matter of compiling the C++ for Windows 10 and getting it installed.

Location in Leeds

Now this Fake GPS driver simply returns the geolocation coordinates which I want, and Cortana thinks that I’m in Leeds. Sorted!

This isn’t a perfect solution. For example you have to switch your OS to run in Test Mode, and obviously the location doesn’t automatically change depending on where you are. However my initial use shows me it’s way more useful than just letting the OS guess the location from the IP address.

Cortana on Windows 10

If people are interested in trying out this solution for themselves, I’ll share the code on GitHub. It shouldn’t be too tricky to add an interface to set the location as required.

Let me know in the comments.

Update

It’s on GitHub at https://github.com/juliankay/FakeGPS