Wednesday, 6 December 2017

Windows Update History Deleted After Sysprep

I've been testing Windows Update History on my virtual machines and noticed that a machine which has had several Windows Updates installed on it was not listing any of them in its Update history:


After a little research, I discovered that it was because the updates were installed on my base virtual machine which I then cloned and ran sysprep on to create the test virtual machine.  It seems running sysprep causes the update history to be deleted.  If I just clone my base virtual machine and do not run sysprep then look at the Update history, I can see all the installed updates:



Monday, 4 December 2017

Windows Patches Installed On Date Incorrect Format on Windows Server 2012

If you run the following on Windows Server 2012

$patches = get-ciminstance Win32_QuickFixEngineering
$patches[0].InstalledOn

you get the date the patch was installed on in American date format MM/DD/YY.  PowerShell then converts the DD part of the date into a month so the result is incorrect.


If you run the same query on Windows Server 2012 R2, the date is correct


If you dig into the code, you can see the issue, here it is in Windows Server 2012



System.Object InstalledOn
{
    get=if ([environment]::osversion.version.build -ge 7000)
    {
        # WMI team fixed the formatting issue related to InstalledOn
        # property in Windows7 (to return string)..so returning the WMI's
        # version directly
        [DateTime]::Parse($this.psBase.CimInstanceProperties["InstalledOn"].Value)
    }
    else
    {
        $orig = $this.psBase.CimInstanceProperties["InstalledOn"].Value
        $date = [datetime]::FromFileTimeUTC($("0x" + $orig))
        if ($date -lt "1/1/1980")
        {
            if ($orig -match "([0-9]{4})([01][0-9])([012][0-9])")
            {
                new-object datetime @([int]$matches[1], [int]$matches[2], [int]$matches[3])
            }
        }
        else
        {
            $date
        }
    };

}

And here it is in Windows Server 2012 R2


System.Object InstalledOn
{
    get=if ([environment]::osversion.version.build -ge 7000)
    {
        # WMI team fixed the formatting issue related to InstalledOn
        # property in Windows7 (to return string)..so returning the WMI's
        # version directly
        [DateTime]::Parse($this.psBase.CimInstanceProperties["InstalledOn"].Value, [System.Globalization.DateTimeFormatInfo]::new())
    }
    else
    {
        $orig = $this.psBase.CimInstanceProperties["InstalledOn"].Value
        $date = [datetime]::FromFileTimeUTC($("0x" + $orig))
        if ($date -lt "1/1/1980")
        {
            if ($orig -match "([0-9]{4})([01][0-9])([012][0-9])")
            {
                new-object datetime @([int]$matches[1], [int]$matches[2], [int]$matches[3])
            }
        }
        else
        {
            $date
        }
    };

}

As you can see, the Windows Server 2012 R2 version has an additional parameter on the DateTime Parse method call which fixes the issue

[System.Globalization.DateTimeFormatInfo]::new()

Thursday, 30 November 2017

XIA Configuration review on 4sysops

If you're interested in inventory and documentation, take a look at the XIA Configuration review recently posted on the 4sysops website, an online community for SysAdmins and DevOps.


The review is written by Timothy Warner who is a Microsoft Cloud and Datacenter Management Most Valuable Professional (MVP).

Bug renaming ODBC System Data Source with Oracle Driver

I created a System Data Source with an Oracle driver and gave it the name "1Data Source Name"


I then changed the Data Source Name to "Aéü1 "#$a%&'+-./:<>^_`|~£©™"


Upon pressing OK, I discover that my System Data Source has been duplicated and I now have two entries, one with the original data source name and one with the new data source name!


I seem to be finding a few bugs in Windows lately!

Friday, 24 November 2017

Bug copying files from host to virtual machine on VMware workstation

I found another bug whilst testing Windows files on my virtual test environment.

I made a folder on my host machine which contains a couple of test files as follows:

C:\aAéü1 !#$%&'()-.@^_`{}~£©™\aAéü1 !#$%&'()+,-.;=@[]^_`{}~£©™.txt
C:\aAéü1 !#$%&'()-.@^_`{}~£©™\aAéü1 !#$%&'()+,-.;=@^_`{}~£©™.txt


I then dragged and dropped the folder onto my virtual machine and was shocked to see that a square bracket had been inserted into both file names!

C:\aAéü1 !#$%&'()-.@^_`{}~£©™\aAéü1 !#$]%&'()+,-.;=@[]^_`{}~£©™.txt
C:\aAéü1 !#$%&'()-.@^_`{}~£©™\aAéü1 !#$]%&'()+,-.;=@^_`{}~£©™.txt



These particular file names are obscure but I do wonder if this could happen in circumstances with more conventional file names that happen to include characters that trigger this bug!

Thursday, 23 November 2017

Brackets removed when copying files in Windows

I've recently been testing files with different names in Windows using a long set of special characters:

aAéü1 !#$%&'()+,-.;=@[]^_`{}~£©™

Part of this testing involved copying these files and I noticed that the round brackets are automatically removed by Windows when doing so!

aAéü1 !#$%&'+,-.;=@[]^_`{}~£©™ - Copy


This only seems to happen if the curved brackets do not contain any text.  If you put some characters between the brackets, they remain when the file is copied.


Wednesday, 1 November 2017

Fix 'Provider load failure' WMI Error 0x80041013

This post describes how to fix error 0x80041013 'Provider load failure' which can occur when using wbemtest to run a WMI query.


Cause

This error can occur when wbemtest does not have sufficient privileges to load the required provider.

Resolution

To fix this error, run wbemtest as an administrator


Your query should now execute successfully