Framework 3.5 Update Fail

Framework 3.5 Update

If you are having dot Net Framework 3.5 Update installation issues, then run the following commands to clear up the issue with the updates.

Event log showed Error 1325.’Microsoft.NET’ is not a valid short file name. 

Create PowerShell Script file .ps1

Note: PowerShell must be installed check windows installed updates from appwiz.cpl

# determine the framework and ebs guids. these will be unique for each install
$productskey = "HKLM:SOFTWAREClassesInstallerProducts"
$installedproducts = get-childitem $productskey
$guidstofix = 1..6
foreach ($product in $installedproducts)
{
$product = $product -replace("HKEY_LOCAL_MACHINE","HKLM:")
$PackageCode = get-itemproperty -path $product -name "PackageCode"
if ($PackageCode.PackageCode -match "4C78A69B7517C0446978C7906EBD7950")
{ $guidstofix[0] = $PackageCode.PackageCode
$guidstofix[1] = $product.Substring($product.LastIndexOf("")+1)
}
elseif ($PackageCode.PackageCode -match "971651411F68D9B4CAF6FCDFB652BB9F")
{ $guidstofix[2] = $PackageCode.PackageCode
# get the guid from the name of the key
$guidstofix[3] = $product.Substring($product.LastIndexOf("")+1)
}
elseif ($PackageCode.PackageCode -match "89C1D03477CD8054881EFCE6FAAFB588")
{ $guidstofix[4] = $PackageCode.PackageCode
$guidstofix[5] = $product.Substring($product.LastIndexOf("")+1)
}
}
# get a list of the registry keys to parse
$regkeys = reg query HKLMSoftwareMicrosoftWindowsCurrentVersionInstallerUserDataS-1-5-18 /s
# find and replace all instances of D? with C?
for ($i = 0; $i -lt $regkeys.Length; $i++)
{
if ( ($regkeys[$i] -match "D?\") -or ($regkeys[$i] -match "C\?\\") )
{
$badkey = $regkeys[$i-1]
$badkey = $badkey -replace("HKEY_LOCAL_MACHINE","HKLM:")
for ($j = 0; $j -lt $guidstofix.count; $j++)
{
$badvalue = (get-itemproperty $badkey $guidstofix[$j] -ea silentlycontinue).($guidstofix[$j])
# filter out null values
if ($badvalue -match "^D?\")
{
$goodvalue = $badvalue -replace ("D?\", "C?")
set-itemproperty -path $badkey -name $guidstofix[$j] -value $goodvalue
write-host ":::::replacing $badvalue with $goodvalue"
}
elseif ( $badvalue -match "^C\?\\")
{
$goodvalue = $badvalue -replace ("^C\?\\", "C:")
set-itemproperty -path $badkey -name $guidstofix[$j] -value $goodvalue
write-host ":::::replacing $badvalue with $goodvalue"
}
}
}
}
# now replace c\?\\ with c:\
if(!(test-path "C:WindowsMicrosoft.NETFrameworkv3.5WFServicesReg.exe"))
{
write-host -fore 'Red' -back 'Black' "Please copy WFServicesReg.exe from a working installation to C:WindowsMicrosoft.NETFrameworkv3.5
"
}
if(!(test-path "C:WindowsMicrosoft.NETFramework64v3.5WFServicesReg.exe"))
{
write-host -fore 'Red' -back 'Black' "Please copy WFServicesReg.exe from a working installation to C:WindowsMicrosoft.NETFramework64v3.5"
}

Here is the direct script download, but I don’t like downloading scripts from the internet as a best practice. But, for you lazy people that don’t want to create the ps1 file and run it yourself: dotnetfixupv2

Note: If it keeps opening up in notepad, select open with and navigate to c:\windows\system32\Windows Powershell\1.0\powershell.exe OR you can run directly from a PowerShell prompt. 

Once the script has run, I’d recommend rebooting your system then re-attempting the update

Leave any Questions and Comments below and I will get back to you. I regularly publish on YouTube, Steemit, and christitus.com so if you’d like to see more videos and articles click the subscribe button in the top right.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: