Skip to content

Instantly share code, notes, and snippets.

@ForNeVeR
Created March 7, 2016 07:39
Show Gist options
  • Save ForNeVeR/5dfd655007f9b0f09c60 to your computer and use it in GitHub Desktop.
Save ForNeVeR/5dfd655007f9b0f09c60 to your computer and use it in GitHub Desktop.
Search registry errors to fix them manually.
$local_key = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'
$machine_key = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*'
$machine_key6432 = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'
$items = Get-ChildItem @($local_key, $machine_key, $machine_key6432)
$ErrorActionPreference = 'Stop'
foreach ($item in $items) {
Write-Output $item.PSPath
$null = Get-ItemProperty $item.PSPath
}
@ForNeVeR
Copy link
Author

ForNeVeR commented Jun 5, 2016

Cross-posting the problem definition here for clarity.

From copyq package (the same problem has been reported to happen with pandoc package also, but it possibly could happen just anywhere):

anyone else having problems installing it? (copyq 2.5.0 on Win10-1511)

Getting this:

PS C:\WINDOWS\system32> choco install copyq -y
Installing the following packages:
copyq
By installing you accept licenses for the packages.

copyq v2.5.0
Installing copyq...
copyq has been installed.
Get-ItemProperty : Specified cast is not valid.
In C:\ProgramData\chocolatey\lib\copyq\tools\chocolateyInstall.ps1:19 Zeichen:8
+ $key = Get-ItemProperty -Path @($machine_key6432, $machine_key, $loca ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-ItemProperty], InvalidCastException
+ FullyQualifiedErrorId : System.InvalidCastException,Microsoft.PowerShell.Commands.GetItemPropertyCommand
The install of copyq was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\copyq\tools\chocolateyInstall.ps1'.
See log for details.

Chocolatey installed 0/1 package(s). 1 package(s) failed.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Failures:
- copyq

Here's how I diagnosed the problem. First of all, execute this script in PowerShell console.

It will print some registry paths and an error. The latest registry path printed is the source of the error. In my case it was HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\nbi-glassfish-mod-3.1.2.23.2

Go to the regedit and check that key. I've found that it had "Invalid DWORD value" in its NoModify key; no idea how did it get corrupted there. I've deleted this NoModify key and after that everything get back to normal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment