I was working with our product support team on an interesting .NET Framework 3.5 SP1 installation failure earlier this week, and I wanted to describe the issue and options for working around it in case anyone else runs into similar issues in the future.
Description of the issue
If you run .NET Framework 3.5 SP1 setup with a user account whose name begins with a # character, the installation will fail.
In this scenario, if you open the verbose MSI log file for the .NET Framework 3.5 SP1 (%temp%\dd_net_framework35*.txt from this list of log files) and search for the string return value 3, you will see an error like the following:
MSI (s) (1A:BC) [11:11:11:111]: Product: Microsoft .NET Framework 3.5 SP1 — Error 1406.Could not write value InstalledBy to key \SOFTWARE\Microsoft\Updates\Microsoft .NET Framework 3.5 SP1\KB953595. System error . Verify that you have sufficient access to that key, or contact your support personnel.
The registry key that is causing this failure is new in the .NET Framework 3.5 SP1, so this error will not occur when installing the .NET Framework 3.5 or earlier.
How to work around the issue
If you encounter this error when trying to install the .NET Framework 3.5 SP1 with a user account whose name begins with a # character, you can do one of the following to work around this and successfully install:
1. Run .NET Framework 3.5 SP1 setup with a different user account
You can either log off and log on with another user account or use the RunAs command to run .NET Framework 3.5 SP1 setup with a different user account that does not start with a # character to avoid this error.
2. Manually set the registry values before running .NET Framework 3.5 SP1 setup
You can pre-configure the problematic registry key and values on your system before installing the .NET Framework 3.5 SP1 to avoid this error. This will cause setup to skip setting the values because they are already present. To do this, you will need to set the following registry values on your system:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Microsoft .NET Framework 3.5 SP1\KB953595]
"PackageName"="Hotfix for Microsoft .NET Framework 3.5 SP1 (KB953595)"
All of the above registry values should be set with the REG_SZ data type. The exact data set for the InstalledBy and InstalledDate values can be set to data of your choosing.
The InstallerVersion value should be set to the Windows Installer major and minor version on your system. You can determine the appropriate value on your system by running msiexec.exe /? and looking at the version number listed at the top of the dialog that appears.
Root cause of the issue
The entry for the InstalledBy value in the Registry table of the .NET Framework 3.5 SP1 MSI is set to the value [LogonUser]. This will set the registry value to the built-in Windows Installer property named LogonUser.
If the LogonUser property begins with a # character, Windows Installer will attempt to write the InstalledBy registry value as a REG_DWORD value (because the # character is a special prefix when used in a registry value as described in this MSDN topic). However, if the LogonUser value is not actually a DWORD, the MSI will fail with a 1406 error like the one listed above.