Category Archives: Reference - Page 2

Updating VLC plug-in in FireFox with 64-bit VLC installed

I discovered this issue as part of checking that all plug-ins in Firefox is up to date (thanks to Adobe’s security mess). The VLC plug-in was listed as outdated so I updated VLC from their web site – the 64-bit version as that is what I use.

Checking Firefox again (plugincheck) I noticed VLC was still listed as outdated with the version unchanged. Thanks to Google I found an article that shows how to get the path of all Firefox plug-ins (about:plugins). This gave me the path C:\Program Files (x86)\VideoLAN\VLC\npvlc.dll . Fortunately VLC provides a plain zip/7zip download of their apps (http://www.videolan.org/vlc/download-windows.html) which you can use to simply copy the files over the old version.

Well, that is one way to skin a… fix a plug-in I mean… 🙂

Windows Update error code list

Just as a reference since I’m also always looking for these myself(pulling my already missing hair out). A list of Windows Update error codes.

https://support.microsoft.com/en-us/kb/938205

One small note. The best one is 0x80240FFF… (WU_E_UNEXPECTED An operation failed due to reasons not covered by another error code). They should just have changed the wording to be a slight bit more honest and say: ‘An error occurred and we haven’t got a clue what it is (as usual)’ 😉

Windows 10 upgrade blues

I’ve been the (un)lucky one that hit the issue where a number of my test VMs all fail to upgrade from build 10159 to 10162. Despite trying all those integrity scans (chkdsk c: /f /r /x) or cleanups (Disk cleanups with remove previous builds) it always failed at around 40%. This was happening on multiple machines (VMs) – some on VirtualBox and even one on Hyper-V.

Checking the setuperr.log file it always seemed the following line was the culprit:

Error      [0x018046] CSI    0000013b (F) Failed execution of queue item Installer: ServiceModelReg Installer ({79675b3f-2054-4efd-aa9d-e1830916be47}) with HRESULT HRESULT_FROM_WIN32(52).  Failure will not be ignored: A rollback will be initiated after all the operations in the installer queue are completed; installer is reliable[gle=0x80004005]

Unfortunately the Internet (Google and Bing) wasn’t kind finding any help on this. Then out of desperation I looked at some of the ‘earlier’ errors which seemed to be ignored and that is all related tp IIS App pool (since I have IIS and Visual Studio 2015 RC installed). I even tried uninstalling Visual Studio on one instance but still no luck. In a moment of almost pure madness I launched the ‘Windows Features’ from Control panel and simply removed IIS from the current installation (including HTTP Activation from the .Net installs). It does not make sense that Microsoft would break their upgrade process due to one of their own technologies but there you have it!

Rerun the upgrade again and… whola it works.

Update: I’ve now confirmed this on 3 different machines. 2 VirtualBox VMs and one Hyper-V VM.

Update 2: Seems the problem is more about having both .Net 3.x and 4.x HttpActivation features on at the same time – http://answers.microsoft.com/en-us/insider/forum/insider_wintp-insider_install/bug-upgrade-81-to-windows-build-10162-fails-if/228b1433-823e-4cd4-90da-72be01c592fb?auth=1

 

Windows 10 in VirtualBox video driver crashes (fix)

I’ve been running a copy (actually 2) of Windows 10 insider preview (build 130 currently) and regularly experience the issue where the video driver provided by VirtualBox crashes and the resolution drops to a standard size using the default Windows 10 display driver. The issue is Oracle (makers of VirtualBox) has not created a new video driver for Windows 10 yet – it is still the default one for Windows 8.x so it probably hasn’t been tested and optimized properly for Windows 10.

To fix the video drive I used to restart the VM which then restores the video driver and restores the resolution prior to the crash. Fortunately I came across some forum posting about another issue I know about on Windows 8 on ATI GPUs where the mouse cursor becomes corrupt that suggests to simply go to Device Manager and disable and then enable the video driver itself to fix the problem. Turns out this also works for Windows 10 video driver crashes. Doing it should not ‘break’ anything since the video driver is in a crashed state anyway when you disable it. After enabling it again Windows 10 automatically restores the previous resolution and all is happy in Insider Preview land again…

Update: I found a way to automate this solution using PowerShell! Using device-management-powershell-cmdlets I created a script that disables and then re-enables the display driver. e.g.

Import-Module "C:\Program Files\Common Files\DeviceManagement\DeviceManagement.psd1"
$DisplayDevice = Get-Device | Where-Object -Property Name -like "VirtualBox Graphics Adapter for Windows 8*"
Disable-Device -TargetDevice $DisplayDevice
Enable-Device -TargetDevice $DisplayDevice

This is assuming you copied the downloaded module to “C:\Program Files\Common Files\DeviceManagement”

Update: I probably should say ‘Touch Wood’ but ever since I upgraded to VirtualBox 5.0 I haven’t had any Display driver crashes again (on Windows 10 build 10166)

Windows 10 guest in VirtualBox – better GPU driver support

Just a heads-up for anyone that might be having issues with display driver issues in VirtualBox. There is an updated (test version) of the VBoxGuestAdditions add-ons available. See the following thread:

https://forums.virtualbox.org/viewtopic.php?f=2&t=67654

Direct download link: https://www.virtualbox.org/download/testcase/VBoxGuestAdditions_4.3.27-99864.iso

In the thread they also make other suggestions like turning 3D acceleration off if you can’t do anything else.

PowerShell ISE on Windows 10 (10049 preview)

Just a quick tip how to get to the PowerShell ISE in Windows 10 which they (MS) seems to be trying to hide away… 🙂

Launch the normal PowerShell command window – “All Apps – Windows System – Windows PowerShell”. Once it is running pin it to the taskbar. Now if you right click on the pinned icon it will include a menu option under Tasks for ‘Run ISE as Administrator’ and ‘Windows PowerShell ISE’.

You can then launch the ISE and pin that to the taskbar as well if you like…

 

Upgrading Windows 10 from 10041 to 10049 issues

I’ve been running a copy of Windows 10 (build 10041) in a VirtualBox VM and had major problems trying to update it to build 10049 (yes on the fast track). Other than the fact that the update/install takes extremely long it also seems to get stuck at 30% – after having being running for more than 24 hours already! I tried multiple times and each time it got stuck at the same time.

So I ventured out on that thing the Internet and found possible related posts of other people having similar issues (on VMWare or even physical installs) – all complaining about the 30% mark where things get stuck. One suggestion caught my eye – sorry, lost the original link to that but basically it suggests disconnecting the network (or pulling the network cable on physical install) just after the update download finished. Additionally some VMWare people suggested removing their VMWare client tools.

So I tried the same on my VirtualBox install. First I uninstalled the VirtualBox client tools. Then I started the install (download). Once the download finished (again…) I disconnected the network (unticked ‘Cable Connected’) and whoa! The install jumped to 30% almost straight away, stayed there for a minute or two (almost made me think this is all for nothing..) and then the progress bar started moving again. Another reboot around 75% and then all were done! Wow!

Well, at least now I’m ‘back’ at build 10049 waiting for the next one (10051)…

 

QuickMon HTTP Activation catch

I recently created a test Windows 8 (8.1) VM to just play around and took the opportunity to test the QuickMon install as well. Usually I simply test on my own machine where I know it works already. This is of course not a major problem in itself but it means I’m not testing what will happen to the tool if you install it on a fresh/clean machine.

Surprisingly/luckily just about everything worked first time – not that I expected less (ye ye a bit arrogant I know 😉 ) and I was happy that QuickMon ‘out of the box’ is so good. However…. there is one thing that did not work as expected (ok ok it did not work at all) – The Remote host functionality built into the Windows Service.

This is actually not a QuickMon problem per se – it is a requirement of or dependency on the underlying operating system that the WCF functionality must be available. The remote host functionality of QuickMon uses HTTP Activation which is not installed by default on a new Windows 8 (or probably previous versions) installation.

The ‘fix’ is really simple – simply go to ‘Control Panel’ -> ‘Turn Windows features on or off’ -> .Net Framework 4.5 Advanced Services (or 4.0 if present) -> WCF Services -> check HTTP Activation on. Then do a reboot even though Windows doesn’t ask for it after the install – somehow the functionality does not really work right away. It should then be working provided you checked all the other know issues – like firewalls and stuff.

I’ll see if I can build in some check into the service itself to generate an error (Event log or something) to high-light if this feature is not available on the operating system where it needs to run.

One more thing to add to QuickMon… hehe

How to access the ‘Service Controller Database’ remotely on a Workgoup network

After having some issues with my home computers not being able to ‘see’ each others services I started digging around for solutions – having already checked all the other possible problems. The main issue is that all these computers are running on an old fashioned ‘Workgroup’ since I don’t have an Active Directory Controller (no Windows Servers). Thus all the machines connect using the same username/password combination.

I’ve made sure of things like firewalls, user accounts (as mentioned already), UAC etc. are all ok but still I got the ‘Cannot open Service Control Manager Database’ error (Access denied (5)). I started suspecting there must be another level of security that is blocking access to view/start/stop Windows services across different machines. Then I stumbled across articles describing ACLs and the issue that to this day Microsoft has not exposed Service ACL’s through .Net yet (yet they have things like File and Registry ACLs exposed through System.Security namespace…).

The only way to get to these ACL’s are through old fashioned Win32 APIs or using the SC.exe utility. I’ve read that someone wrote a C# wrapper class for these somewhere but I could not find any remaining source of this through Google. Bummer… Then using the SC.exe utility through some nasty loosely coupled integration is the only solution…

To view the current DACL (Discretionary Access Control List) for ‘Service Controll Manager’ you can use the followig command on the source/host computer you want to connect to:

sc sdshow scmanager

That should give you something like this:

D:(A;;CC;;;AU)(A;;CCLCRPRC;;;IU)(A;;CCLCRPRC;;;SU)(A;;CCLCRPWPRC;;;SY)(A;;KA;;;BA)S:(AU;FA;KA;;;WD)(AU;OIIOFA;GA;;;WD)

Now, the part that was relevant to me using a ‘Workgroup’ network is the (…AU) part because for some reason even though I’m using the same user account/Password on all machines – and this account is an Administrator on each machine, the system only recognize the user as part of the Authenticated users group ONLY. Thus the  (A;;CC;;;AU) part is not sufficient to allow access to the service control manager database…

To get access to the Service Controller Database you need permissions like this: (A;;CCLCRPRC;;;AU)

To understand what all those letters use please refer to ‘Best practices and guidance for writers of service discretionary access control lists‘ which explains the whole lot. The following command can be used to ‘fix’ the access to the ‘Service Controller Database’: (note that is is just an example!! Check the output of the previous command first)

 sc.exe sdset scmanager D:(A;;CCLCRPRC;;;AU)(A;;CCLCRPRC;;;IU)(A;;CCLCRPRC;;;SU)(A;;CCLCRPWPRC;;;SY)(A;;KA;;;BA)S:(AU;FA;KA;;;WD)(AU;OIIOFA;GA;;;WD)

After running this you should be able to access the  ‘Service Controller Database’ remotely (assuming all the other things have been checked). All good and wonderful! uhmm… Then I discover this does not display all services… bugger again..

Actually there are two parts to the original problem – as I discovered that each Windows service on its own has an ACL that can/should be set. Some ‘system’ services already come with permissions for AU (Authenticated Users) so they are visible by default. Most other and particularly my custom created services don’t have the right ACLs set. To fix that is simple… Just repeat the process above for that particular service – like this (for my QuickMon 3 Service):

Sc sdshow "Quickmon 3 service"

This should give an output like this:

D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD)

As you can see it does not have any permissions for AU. To fix access to that server you simply have to add the AU permissions like this:

sc.exe sdset "Quickmon 3 service" D:(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD)

Now of course you have to repeat this for each Windows Service you need access to…

To help in this process I created the following PowerShell script that list all Windows Servers plus their ACLs:

$services = @{}
Get-Service | foreach {
    $DACL = sc.exe sdshow $_.ServiceName
    $service = @{
        'ServiceName' = $_.ServiceName
        'DisplayName' = $_.DisplayName
        'ServiceType' = [string]$_.ServiceType
        'DependsOn'   = [string]$_.ServicesDependedOn
        'State'       = [string]$_.Status
        'DACL' = ([string]$DACL).Trim()
    }
    $serviceObj = New-Object -TypeName PSObject -Property $service
    $services.Add($_.ServiceName,$serviceObj)
}
$services.Values | select ServiceName, DisplayName, ServiceType, State, DependsOn, DACL | Sort-Object ServiceName

Now you have to repeat the whole process for each service… And that is how it’s done… Enough to keep you out of mischief or perhaps enough to get you into it again…

Getting GDI object count per process in Powershell

Ever wanted to query the GDI object count in PowerShell per process?

Here’s how:

"Number of GUI handles per process"
$sig = @'
[DllImport("User32.dll")]
public static extern int GetGuiResources(IntPtr hProcess, int uiFlags);
'@

Add-Type -MemberDefinition $sig -name NativeMethods -namespace Win32

$processes = [System.Diagnostics.Process]::GetProcesses()
[int]$gdiHandleCount = 0
ForEach ($p in $processes)
{
    try{
        $gdiHandles = [Win32.NativeMethods]::GetGuiResources($p.Handle, 0)
        $gdiHandleCount += $gdiHandles
        $p.Name + " : " + $gdiHandles.ToString()   
    }
    catch {
        #"Error accessing " + $p.Name
    }
}
"Total number of GDI handles " + $gdiHandleCount.ToString()

Alternatively you can use Process Explorer from Microsoft (originally sys-internals) if it is installed.