Microsoft Edge hmm we can't reach this page

07/09/2015 19:09:00
Luke McGrane

Microsoft Edge, the new name for (or replacement to) Internet Explorer, has a bug where it may not be possible to browse any websites unless you are connected to a 'Private' network.

Changing the network location has traditionally been very difficult but Windows 10 includes an easy way of doing this. In the control panel look for Home Group and choose to search for other machines on the network and allow yours to be discoverable. Now Edge will work


WMI Windows Management Instrumentation

08/08/2015 14:52:18
Luke McGrane

I am running a VPS with only 50Gb disk space so have to regularly clear log files and such which, as an unimportant server only personal stuff, I wasn't too fussed about automating. This VPS was purchased originally so I could code things and try them out online so I decided to look into building a tool to easily visualise the state of a Windows system.


There's so much information about WMI that it can be difficult to know where and how to start so my first stop is to begin getting to grips with what exactly WMI is in terms of what the relationship is between it and the things it is telling you about and what the data model looks like.

WMI uses the Common Information Model (CIM) to interact with, and even control, system data. The Wikipedia article explains that this model is updated regularly and provides a helpful link to the Distributed Management Task Force site where the specifications are publically available. For example, this is the current (from June 2015) complete CIM specification: DMTF Schema Documentation 2.44.1.

At this point I now have the information available to know exactly what is possible through WMI but this is entirely different to what Windows will actually let me do. The next step is to decide on how I'm going to interact with WMI.

The MSDN has a helpful article which gives an overview of what providers can be used and how they work. From the WMI Architecture article I know that anything which can query COM will work and that .NET is by design the best choice.

Coding begins...

It's at this point where things get tricky because there are several ways of working with WMI and it seems you, as the programmer, kind of need to know all of them to get anything useful in .NET because you're simply provided some objects like ManagementObject and ManagementClass and left to your own devices. There is no nice enum of every piece of information you might want to pull from WMI and while you can search online it's very likely the 'name' of something that looks interesting simply won't work through .NET. Also, the DMTF CIM scheme documentation gives you their name for everything but Microsoft obscures this by modifying their implementation of the scheme. For example, CIM_PROCESS is now WIN32_PROCESS. This does actually make sense in one way as CIM is a method of describing data and it can be used on far more than just Windows but Microsoft want to give their users only information relevant to Windows and, of course, put their own spin on things.

Thankfully Microsoft have listed all of their WMI classes on the MSDN and that is exactly what I've been searching for: Performance Counter Classes.

using System;

using System.Windows.Forms;

using System.Management;


namespace WMITesting


    public partial class Form1 : Form


        public Form1()





        private void Form1_Load(object sender, EventArgs e)


            ManagementClass mc = new ManagementClass("Win32_PerfFormattedData_PerfOS_Processor");


            foreach (var p in mc.Properties)

                textBox1.AppendText(string.Format("{0}={1}\r\n", p.Name, p.Value));




This works in as much as it gives some information back to me but, oddly, the collection it returns does not contain any values.

As it turns out, all this code does is create a new instsance of Win32_PerfFormattedData_PerfOS_Processor instead of requesting a proper one from the system. Getting it to actually get any values from the system is confusing at first and I learned that WQL is used for ManagementObjectSearcher while a 'standard' ManagementPath will use something like \\.\root\CIMV2: Win32_LogicalDisk.DeviceID="C:" as the example shows in MSDN. I know what information I want so I don't want to do a search every time the application updates so I need to find how to get a current instance of Win32_PerfFormattedData_PerfOS_Processor which means finding what that 'path' should be. Clearly the application needs to be told where to look to get the data and this is done using ManagementScope.

private void Form1_Load(object sender, EventArgs e)


            ManagementScope wmiScope = new ManagementScope(@"\\.\root\cimv2");

            ManagementPath wmiPath = new ManagementPath("Win32_PerfFormattedData_PerfOS_Processor.Name=\"_TOTAL\"");

            ObjectGetOptions wmiOptions = new ObjectGetOptions(null, TimeSpan.MaxValue, true);

            ManagementObject wmiObject = new ManagementObject(wmiScope, wmiPath, wmiOptions);


            foreach (var p in wmiObject.Properties)

                textBox1.AppendText(string.Format("{0}={1}\r\n", p.Name, p.Value));




What if I want more granular information instead of just looking at _TOTAL for the process class or C: for the disk. I might want to list everything that's available and let the user decide. After a lot of playing around and trying to avoid using the searcher it became clear that ManagementObject is for single instances while ManagementClass lets you get all instances of the class.

private void Form1_Load(object sender, EventArgs e)


    ManagementScope wmiScope = new ManagementScope(@"\\.\root\cimv2");

    ManagementPath wmiPath = new ManagementPath("Win32_PerfFormattedData_PerfOS_Processor");

    ObjectGetOptions wmiOptions = new ObjectGetOptions(null, TimeSpan.MaxValue, true);

    ManagementClass wmiClass = new ManagementClass(wmiScope, wmiPath, wmiOptions);

    var wmiInstances = wmiClass.GetInstances();


    foreach (var i in wmiInstances)

        foreach(var p in i.Properties)

            textBox1.AppendText(string.Format("{0}={1}\r\n", p.Name, p.Value));



This code gives the same output as before but with data and includes every instance of the Win32_PerfFormattedData_PerfOS_Processor class.


That's it for this post. I've gone from using WMI only through the command line to knowing where to find all the class names & their descriptions then pulling back individual or all instances of that class in any application I want. The next obvious step is to query remote computers but I'm thinking of looking at how to display the data in a different way and may do another post about it at some point.

Surface Pro 3 - My Experience

21/06/2015 07:56:38
Luke McGrane

I’ve had my Surface Pro 3 i5 256Gb model for about a month now and I still like it. It has replaced my much more powerful desktop as I can now sit much more comfortably in the living room while randomly browsing the Internet or working instead of being cooped up in the home office.

I’ve found the Surface to be extremely portable to carry about the office and very useful in meetings as I can quickly doodle a diagram to show what I mean or make a note of something easily. Before purchasing I looked around a lot to find cheaper deals or even a different tablet but couldn’t find anything. If you’re going to buy a Surface you will most likely find the cheapest option to be from Microsoft themselves. I got a bundle, including type-cover; Ethernet and Miracast adapter; case; Office subscription, cheaper than I could have bought just the Surface itself from PC World.

Item bundle

The Surface Pro 3 is definitely worth getting in my opinion but it is expensive and it does have some odd bugs/special features.


  1. HOT! The Surface gets very warm, to the point of being uncomfortable to touch, if doing anything even mildly strenuous. I believe the processor is in the top right quarter of the device based solely on the heat emanating from there.

  2. LOUD! The Surface is an actively cooled device meaning there is a fan inside which will spin up to cool the internal components when needed. The oddest time this fan kicks in, and I really mean kicks in as it sounds like a jet taking off, is when sat completely idle but plugged into mains.

  3. WiFi connectivity seems to simply not work for a few minutes after waking up from sleeping. I’ve found it to be more problematic if I sleep the device at one location then move to somewhere else with a different network. It usually takes six attempts to reconnect.
    So, it turns out I blocked DHCP in the firewall like a complete idiot. Live and learn!

  4. The case doesn’t let the pro use its multi-angle stand, instead fixing it at roughly 45 degrees. This is fine for general use on a desk but pretty annoying on your lap. It’s easy enough to take it out of the case but who wants to fiddle with that every time?

These four points should not be enough to sway you away from getting one because they are just so useful. I am now free to work creatively wherever I want, even if there’s no WiFi or electricity I can simply sit down with a full charge and tap away in Visual Studio or do a bit of drawing.

The Stylus

The pen is very good to use because it feels just so natural. If you’ve ever used a Biro you’ll be fine with the Surface Stylus – just don’t get the two confused. The included drawing app FreshPaint is great if, like me, you like to draw but the best thing about drawing on the Surface is that you don’t have to know anything special or be any good at all. I’m terrible at drawing and partly wanted a Surface Pro 3 to give the multi-pressure stylus a go and while it’s clearly different to pencil/paint on paper it is very nice to use. The most useful part of it all is the undo function! This is a wildly useful concept only available on an electronic device and really helps those of us who simply cannot draw but would like to try.

Other than drawing, the pen is provides a quick shortcut to OneNote by pressing the button on the top where the rubber (‘eraser’ for the rest of the world) would be on a pencil. This, again, is useful in meetings because I can switch on and get into OneNote before the person has stopped talking so I can begin taking notes straight away.

I would say that the stylus is essential to the Surface and trying to use it with touch-only feels clunky on the normal Windows interface. Simply because a human finger is fatter than the fine point of the pen it’s too easy to click the wrong option or select the wrong bit of text on the high-resolution display but the stylus solves that. Also, it easily attaches to the surface by magnetism on the charging port which is strong enough to hold the pen in place while you move about. I’ve recently used the surface to take notes while standing, holding it like I would a clipboard with my fingers on the screen with one hand and writing with the other. This worked fine in OneNote and because I did not have the type cover or case attached I was able to magnetically attach the pen to the type cover port which all felt great to use, very natural and frankly amazing to have such a powerful device in something the size of a regular clipboard.


Wireless HDMI Adapter - Miracast

The wireless HDMI adapter works surprisingly well with the Surface and very easily connects as a second display which can then duplicate, extend, or replace the primary. The only downside is that there seems to be about a 600ms lag (rough guess) which is long enough that action games are not really playable. I also found that some websites reject the use of a second display due to copyright issues which is absolutely stupid and severely puts me off using Blinkbox again but Netflix worked fine. The best thing about the adapter is that it is not proprietary hardware so it’ll happily work with the Surface or my Android phone. Microsoft have made a good product with this though I would not buy one at the full retail price it is well worth getting as part of a bundle.

Ethernet Adapter

It works. It’s a USB 3 connector gigabit Ethernet adapter and it works. There’s not a great deal other to say about it except that it, too, gets unusually warm.

Office 365 Subscription

It’s hard to argue that anything else is better than Microsoft Office because you’d simply be wrong. From a business perspective I’d love to find an alternative, and there are some very good ones, because Microsoft are literally insane when it comes to licensing and often it seems that those who decide how much things should cost are simply reciting a phone number they once heard. However, for a domestic user the cost isn’t too bad and if you actually do use Word/Outlook/Excel the price is easily justifiable. Personally, I like Microsoft Office but probably not enough to renew the subscription next year because there are very good alternatives that are either free or a one-off cost.


I looked at a lot of reviews before finally purchasing a Surface and they all pretty much said not to get a Pro 3 for gaming. I wanted one mainly for work anyway so wasn’t too phased but I, of course, ignored the reviews and installed Steam. The only game I’ve really tried has been Elite: Dangerous which does work but makes the fan bellow like an injured lion and I can almost hear “taking heat damage” from the Surface, not the ship, while entering a station. I’ve not tried it in combat because I’ve not figured out a control set I’m happy with on the Xbox controller yet but I can easily imagine it being unplayable. However, Supreme Commander 2 worked OK as did Civilisation 5 but what I mean by “worked fine” is that they loaded and when I got into a game it didn’t seem to lag. The touch interface for games is something that’s still a bit mind-blowing to me so I’ve not spent more than 10 minutes in either. I’ve also tried Don’t Stave which isn’t touch aware but there is a mod that adds this and, again, seems to work OK for the few minutes I played.


Being a Windows 8.1 Pro installation it comes with the option to install Hyper-V which I have done and find extremely helpful. It’s more of a toy because I can spin up a pfSense and Windows Server 2012 Eval to play with networking configurations or whatever else I like right there on the Surface. With only 8Gb memory I have to be a little more reserved about how much I allocate to each running VM but for most things I don’t need any more than four anyway and, with Linux, 768Mb memory or less is usually fine.



Get one if you want something that is easy to carry around but still powerful enough to do pretty much any professional work you want.

© Luke McGrane 2015 Login