SOLVED: A case of a failing Windows Update (KB3124200) on Windows 10

I’m writing this post mainly to myself, explaining how I figured out why this particular Windows Update package was failing to install on my Windows 10 (installation began, then rolled back). This can serve as a general troubleshooting step when google searches lead you nowhere.

TL;DR in my particualr case, (temporary) enabling the Administrator user (after running sfc /scannow in an elevated prompt, followed by net user administrator /active:yes) allowed the update to install successfully! After installing and rebooting the machine, I disabled the built-in Administrator account using net user administrator /active:no from an elevated prompt.

/verbose

After failing to install the update, from both Windows Update and manually downloading it, I turned to the web, trying to find solutions. Most of the forums describing the problem were either abandoned, or given the basic generic troubleshooting tips, which are rarely useful (all they tell you there’s a problem, as if you didn’t know).

One of those “tips” is running sfc /scannow. The result of running this check is a (sometimes huge) log file called CBS.log, located in

%WinDir%\Logs\CBS\CBS.log

This log file will also be created as part of the standard system file checking done by installing Windows Updates.

What I did was, after my computer failed to install, and rolled back the installation again, was open this log file in Notepad++, then searching for entries with Error. Surprisingly, I saw a few lines that looked like this:

2016-01-11 20:17:42, Info   CSI    00000046 Loading user account SID [l:92{46}]"S-1-5-21-3692211415-2751783221-3488552363-1001"
2016-01-11 20:17:42, Info   CSI    00000046 Loading user account SID [l:92{46}]"S-1-5-21-3692211415-2751783221-3488552363-500"
2016-01-11 20:17:42, Error  CSI    00000048@2016/1/11:20:17:42.338 (F) base\wcp\rtllib\inc\auto_hive.h(105): Error STATUS_OBJECT_PATH_NOT_FOUND originated in function Windows::Rtl::AutoHive::Load expression: (null)
[gle=0x80004005]
...

So it seems that it was trying to load a user account with SID ending in –500, and failed. Googling for the error text led me to this post on the Microsoft forums, describing a similar problem. A little down on page 3, someone suggested running a PowerShell command, dumping all the user SIDs to the console:

get-wmiobject -class "win32_account" -namespace "root\cimv2" | sort caption | format-table caption, FullName, SID 

Which led me to see that the problematic SID belonged to the Administrator user! On Windows 10 machines, the Administrator account is disabled by default, and this is why I suspected the update was trying to install itself into the Administrator user’s hive, but couldn’t find it.

I’ve enabled the Administrator account using a net user command:

net user Administrator /active:yes

And tried installing the update again. To my surprise, it installed successfully and didn’t roll back!

After rebooting, I verified the update was listed in Windows Updates’ history, and disabled the Administrator account again.

If your updates failing to install:

  • run sfc /scannow
  • check CBS.log
  • hope for the best!

Good luck!

Review: my new HP Spectre x360 2-in-1 convertible laptop

I decided to get with the times, and get myself a mid-level ultraportable machine I can carry around while traveling. Knowing almost nothing about this category of computers (and having avoided touch-enabled hybrids/tables until now), I spent considerable time researching. My requirements were simple:

  • a secondary machine (my 3 year old behemoth HP EliteBook 8570w is still the best development machine I’ve got)
  • light, portable (so, about 13”), touch-enabled (most of them are, anyway)
  • good typing experience (I considered a Surface 3/4 with Type Cover keyboard, but typing experience got mixed reviews)
  • $1000 or less

I decided to take advantage of the Black Friday sales and finally settled on the HP Spectre x360, a gorgeous 13” 2-in-1 convertible computer, which was designed by HP together with Microsoft, and given away at Build 2015 to the participants. I’m not going to review it here, I’ll leave this task for Lisa Gade from MobileTechReview, who did an exceptional job reviewing every possible aspect of this computer, including benchmarks. Lisa also did multiple follow-up reviews, comparing the Spectre to the Surface Pro 3, Dell XPS 13, a Macbook Pro and even the new Surface Book. Needless to say, after watching all those reviews, I had no doubt the Spectre is going to be my new machine!

As I’m typing this, it turns out there’s a newer (limited edition) of the Spectre out, with a 6th generation Skylake processor (mine was 5th generation Broadwell) and a gorgeous Ash Silver finish, but as I mentioned, I didn’t need a spec’d out machine. My 5th gen i7 with 8GB of RAM and 256GB SSD suit me just fine, and I got no buyer’s remorse! (/crying)

And now to some more interesting details. There were few things I needed to do, to make this machine usable. First, the keyboard backlight button. The Spectre x360 has a backlit keyboard which can be toggled on and off with the (Fn)F5 button, unfortunately, when it’s off, the F5 button is still lit, reminding you to press it. Luckily, HP released a BIOS update, adding an option to turn this light off. To access the BIOS, hammer on the Esc after powering the machine on, until you get a menu. Press F10 to enter the BIOS.

The second part had to do with repaving the machine and installing Windows 10 on it from scratch. Even though this is a Microsoft “signature edition” computer, meaning it comes with (very little) bundled software, I am old school (emphasis on the old), and wanted to repave and repartition the machine myself, from a bootable USB stick containing Windows 10. However, when I went to the drive selection in the post-boot menu, I did not see my USB stick – I could only see UEFI entries. A quick search led me to one of two possible solutions: enable Legacy Mode (CSM) in the BIOS, or create a bootable UEFI Windows 10 USB stick using a wonderful utility called Rufus, which not only supports creating bootable UEFI sticks, it’s x2 faster than the old Windows USB utility! After creating the UEFI stick per instructions above, I was able to boot from it, and install Windows 10 from scratch.

I’ve now typed this review on the Spectre, and the experience is amazing! The keyboard feels sturdy, the trackpad is precise (albeit big – iPhone 6 big) and I even flipped the screen over to use some touch apps (for the first time ever). I am happy with my new HP Spectre x360 and can definitely recommend it!

7 open-source Visual Studio Extensions to make your life easier

It’s time to upgrade your favorite IDE! In this post I will list some of my favorite “off-the-beaten-path” extensions for Visual Studio that make my daily tasks much easier. I will not list the obvious ones, such as ReSharper and OzCode (or even Web Essentials), but rather few relatively unknown ones that do some very cool things.

Are you ready? Let’s begin!

BuildVision

BuildVision (source) is an extension that visualizes your build process:

This little extension shows you the status of your build process, how long it took, and most importantly, errors (if any), that occurred during the build. What’s nice about this, is the errors are grouped under each project, so it’s much easier to navigate than going through a flat list in the Errors output:

Git Diff Margin

GitDiffMargin (source) adds a margin on the left column (or the scroll bar, if you prefer) of the Visual Studio editor, and shows you the diffs between your changed/deleted lines, allowing you to navigate and revert quickly to the previous change!

It’s a perfect companion to git projects (so, all of them!), and it works very nicely with the Visual Studio Git Provider, if you use it.

Which brings me to:

NoGit

NoGit (source) does one thing and one thing only – it disables the built-in Visual Studio Git source-control provider, which has a habit of re-enabling itself whenever you open a solution that uses git. NoGit will turn off this provider always, whenever a solution is opened.

Reopen Start Page

Another time saver is Reopen Start Page (source), which does exactly what it says – reopens the Visual Studio Start page when you close a solution. Personally, I make use of the recent solutions list on the Start page, which makes it really convenient to open recent solutions!

SaveAllTheTime

SaveAllTheTime (source) is another gem that makes Visual Studio to save changed files and projects ALL THE TIME. Visual Studio sometimes doesn’t save project files when you rename or move files around. SaveAllTheTime makes sure everything is saved before you commit your changes!

In addition, SaveAllTheTime contains a small widget, reminding you to commit often. If you’re a git power user, or don’t use git(!), you can disable this widget.

TabSanity

I discovered TabSanity (source) fairly recently, and it was one of those “where has this been all my life!!1” moments. This extension makes tabs-as-spaces behaves like actual tabs! The backspace and delete keys, arrow key navigation will not allow the caret to land within the spaces that form a tab, and it will skip to the next “tab”, saving you keystrokes!

EmojiVS

Finally, let’s add some fun to our code with EmojiVS (source) – an extension that adds github emojis to your code (more specifically, code comments). Because, why not?

And it even gives you IntelliSense:

Note: if you’re a ReSharper user, you need to install the ReMoji extension in addition to EmojiVS to get code completion.

Preventing a certain Windows Update from installing on Windows 10

TL;DR this post explains how to prevent a certain update from installing on a Windows 10 machine (at the time of writing, build 10049). The information below might not be accurate/relevant for future updates.

During its preview, Windows 10 does not allow (by default), changing how updates are installed. It was possible to modify this using various Group Policy settings and a bit of registry tweaking, but since build 10049 it no longer works – it’s not possible to restore the “old” Windows Update applet in Control Panel.

On my machine (HP EliteBook 8570w), an update for the Synaptics TouchPad drivers took away my middle button, it simply did not appear anymore on the TouchPad properties. Uninstalling the update, and installing the Windows 8.1 Synaptics driver from the HP website helped, but within a day it was automatically updated again.

An answer on SuperUser suggested disabling all automatic driver updates, but I didn’t want to do that. Luckily, I found a way to disable this particular update despite Windows Update settings were not changeable with a wonderful set of PowerShell tools called Windows Update PowerShell Module.

Here’s how to install the PowerShell module and disable unwanted Windows Updates:

1. Download the Windows Update PowerShell Module, and extract it to either

%USERPROFILE%\Documents\WindowsPowerShell\Modules

or

%WINDIR%\System32\WindowsPowerShell\v1.0\Modules

(the former does not require elevation)

2. Temporary disable Execution Policy, to allow importing unsigned scripts. From an elevated PowerShell console type

Set-ExecutionPolicy Unrestricted -Force

followed by:

Import-Module PSWindowsUpdate

After the module had been imported, restore the Execution Policy to a reasonable setting, such as RemoteSigned.

3. Uninstall the unwanted update (if installed), then run the following command to get a list of all available windows updates:

PS > Get-WUList

ComputerName Status KB          Size Title
------------ ------ --          ---- -----
LAMBDACORE   D-----            65 MB Synaptics driver update for Synaptics SMBus TouchPad
LAMBDACORE   D----- KB2956185  68 MB Update for Microsoft OneDrive for Business (KB2956185) 64-Bit Edition
LAMBDACORE   D----- KB2965255  11 MB Update for Microsoft Office 2013 (KB2965255) 64-Bit Edition
...

4. Hide the “Synaptics driver update” by issuing the following command:

PS > Hide-WUUpdate -Title "Synaptics driver*"

ComputerName Status KB          Size Title
------------ ------ --          ---- -----
LAMBDACORE   D--H--            65 MB Synaptics driver update for Synaptics SMBus TouchPad

The letter H now signifying that the update is hidden! That’s it, the update will now be hidden from Windows Updates, and won’t be installed. To unhide, run:

PS > Hide-WUUpdate -Title "Synaptics driver*" -HideStatus:$false

Now, all I have to do is change the two-finger scroll direction, and I can get back to work!

Adding a custom property page to existing project types in Visual Studio

Note: this post assumes some knowledge developing Visual Studio Extensions (VSIX).

Suppose you’re developing custom tooling that enhances (or otherwise modifies) current project types (for example, C# class libraries or Web applications). This is most commonly done by specifying custom MSBuild properties, typically by adding a .targets file to the project file itself (possibly via NuGet, which can import .targets files automatically).

One common way to interact with those custom properties is by adding a page in the project properties, however, most documentation about extending project properties refers to creating your own project systems. Any documentation about extending existing projects is either out of date, or nonexistent.

But, when there’s a will – there’s a way. TL;DR: Here’s how to add a custom property page to a regular C# console application:

  1. Create an (empty) VSIX project
  2. Add a reference to the following assemblies: Microsoft.VisualStudio.AppDesigner.dll (located in the GAC), and Microsoft.VisualStudio.ManagedInterfaces.dll (from the Visual Studio SDK)
  3. Create a new class that derives from Microsoft.VisualStudio.Editors.PropertyPages.PropPageBase
  4. Implement the class as follows:
[ComVisible(true)]
[Guid("some-guid")]
[ProvideObject(typeof(MyPropertyPageProvider))]
public class MyPropertyPageProvider : PropPageBase
{
    protected override Type ControlType
    {
        get { return typeof(MyPropertyPageControl); }
    }

    protected override string Title
    { 
        get { return "My Property Page"; } 
    }

    protected override Control CreateControl()
    {
        return new MyPropertyPageControl();
    }
}

Make sure to provide a new GUID in the GuidAttribute (tip: if you use ReSharper, you can create new GUIDs on the fly by typing nguid and pressing Tab), we will need this GUID again soon. Specify the title of your property page, and provide an instance of a UserControl-derived (WinForms, baby!) page that will be the UI. Visual Studio provides an abstract Microsoft.VisualStudio.Editors.PropertyPages.PropPageUserControlBase class you can derive from.

 Important: Visual Studio will try reading the size of the control from the assembly’s compiled resources – this requires a .resx file for the user control. Best to create a new User Control using the Add – User Control context menu (so it can have a .Designer and a .resx files), and change the base type to PropPageUserControlBase afterwards.

One last piece of the puzzle is hooking it up – this is where a bit of MSBuild magic comes in. After running your extension (in the Experimental Instance), create a new, say, C# Console application. When the project is created, open its .csproj file in Notepad (or your favorite editor), and add the following property into one of the PropertyGroups (or create your own PropertyGroup, e.g.):

<PropertyGroup>
  <CfgPropertyPagesGuidsAddCSharp>{some-guid}</CfgPropertyPagesGuidsAddCSharp>
</PropertyGroup>

Using the GUID from before. Save the .csproj file, and when you reload it in Visual Studio, you will now have a brand new (albeit empty) property page in the project’s properties!

(You can probably add this property dynamically with DTE from your extension, instead of modifying existing projects, but I haven’t tried it.)

So what happened? Where did CfgPropertyPagesGuidsAddCSharp come from, and what makes it so special? Turns out, after a long investigation, it’s an undocumented property, which is a part of the legacy C# and VB project systems. When Visual Studio processes C# or VB projects, it will look for this property, and attempt to instantiate the COM class at a given GUID. If successful, it will add it as a property page.

I was able to confirm this works in Visual Studio 2013 and 2015, not sure about the earlier editions.

So there you have it, a bit of undocumented functionality makes the impossible possible Smile

Happy hacking!

Disabling certain “invisibles” in the Atom Editor

I recently started using GitHub’s Atom editor, and other than the slow-ish startup time, I love it very much!

One of the things I hate most is redundant whitespaces, so in all editors I use, I try to work with visible whitespace enabled, so I can keep those tiny dots in check. In the Atom editor, this feature is called Show Invisibles, however by default it shows all the invisible characters, including endof and newline characters. There’s no UI (yet?) to toggle which ones you want to see, but luckily, Atom is completely “hackable”, allowing us to do change about anything!

To remove the EOL/newline characters, go to File → Open your Config. The configuration file will open in a new tab, where you can modify the invisibles: entry like so:

"*":
  editor:
    invisibles: 
      eol: false
      cr: false
    ...

Upon saving the file, Atom will immediately reload the configuration, and only the whitespace dots will remain visible!

For more information about what can be changed, check out Customizing Atom.

A case of mysterious spam links!

Update: I was rightly corrected by the creator of μBlock, those are not links, but CSS selectors inside a <style> tag, to cause the offending links to be removed from the page. Furthermore, those particular rules are being fed from AdBlock Plus’ EasyList, and they are not related to μBlock.

I was tweaking a Jekyll theme to match the style of our Bootstrap-based site, when I suddenly noticed an alarming links to porn/spam sites, visible inside Chrome tools:

Alarmed, I didn’t know what to make of this at first. It’s a custom (paid) Bootstrap theme, so I suspected either the theme or one of its plugins was the culprit, however I could not find any code that seemed to inject this particular style.

Armed with fairly little knowledge of dealing with web development, I decided to try and set a breakpoint inside the Chrome tools on the text inside the <style> element itself, by right-clicking and selecting Break on… → Subtree modifications:

I reloaded the page and then found myself inside a script called contentscript-start.js, which turned out to belong to μBlock:

Thanks to George Pollard (@porges) I was led to this issue on the uBlock github, where it seemingly replaces all instances of http://face* with a matching filter (which, in this case, a link to a porn site). The reason for this is still unclear to me, as face* generates way more false positives (i.e. facebook).

This also explains the other link: the bottom of my Bootstrap page contains a link to the Facebook and LinkedIn pages. uBlock must be matching http://link* as well.

So if you find those while looking at your site through Chrome dev tools, don’t be alarmed as I was – it’s just your friendly neighborly adblock in action!