Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keepass-plugin-favicon: "Specified cast is not valid." #167

Closed
2chg opened this issue Mar 29, 2016 · 4 comments
Closed

keepass-plugin-favicon: "Specified cast is not valid." #167

2chg opened this issue Mar 29, 2016 · 4 comments

Comments

@2chg
Copy link

2chg commented Mar 29, 2016

Whenever I try to install the keepass-plugin-favicon package on a Windows 10 Pro system the installation aborts with the following error:

> choco install -y keepass-plugin-favicon
Installing the following packages:
keepass-plugin-favicon
By installing you accept licenses for the packages.

keepass-plugin-favicon v1.9.0
 Specified cast is not valid.
 At C:\ProgramData\chocolatey\lib\keepass-plugin-favicon\tools\chocolateyInstall.ps1:66 char:3
 +   throw $_.Exception
 +   ~~~~~~~~~~~~~~~~~~
     + CategoryInfo          : OperationStopped: (:) [], InvalidCastException
     + FullyQualifiedErrorId : Specified cast is not valid.
The install of keepass-plugin-favicon was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\keepass-plugin-favicon\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:
 - keepass-plugin-favicon
@2chg 2chg changed the title "Specified cast is not valid." on choco install keepass-plugin-favicon: "Specified cast is not valid." Mar 29, 2016
@dtgm
Copy link
Owner

dtgm commented Jun 18, 2016

Caused by a bad registry key created by another program. Please copy paste the following code and let me know which program it is.

$hkcu = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'
$hklm = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*'
$hklmWow = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'
[array]$keys = Get-ChildItem -Path @($hkcu, $hklm, $hklmWow) -ea SilentlyContinue
[bool]$success = $FALSE
[int]$maxAttempts = 10
for ([int]$attempt = 1; $attempt -le $maxAttempts; $attempt++) {
  try {[array]$foundKey = Get-ItemProperty -Path $keys.PsPath -ea SilentlyContinue | ?{$_.DisplayName -like "*"}; $success = $TRUE;}
  catch {
    foreach ($key in $keys){
      try{Get-ItemProperty $key.PsPath > $null}
      catch{$badKey = $key.PsPath}
    }
  Write-Warning "Found bad key: $badKey"
  [array]$keys = $keys | ?{$badKey -NotContains $_.PsPath}
  }
  if ($success) {break;}
}

details about why in #92
general solution in #198, and will be implemented specifically for this pkg in #222

As you may have noticed, this bug affects many packages on chocolatey.org and most all install packages I maintain. This will be slowly snuffed out as old packages get updated. For now, the workaround is to remove the offending application, or, if you need the offending software installed, fix the bad registry key.

@2chg
Copy link
Author

2chg commented Aug 2, 2016

Hello,

sorry for the late anwser.

The given script returns the following „bad“ registry key:

WARNING: Found bad key:
Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\nbi-nb-base-8.1.0.0.201510222201

What do you think I should do next?

Sincerely yours

Christian

On Sat, Jun 18, 2016 at 11:01 PM, dtgm [email protected] wrote:

Caused by a bad registry key created by another program. Please copy paste
the following code and let me know which program it is.

$hkcu = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall*'$hklm = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall*'$hklmWow = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall*'[array]$keys = Get-ChildItem -Path @($hkcu, $hklm, $hklmWow) -ea SilentlyContinue[bool]$success = $FALSE[int]$maxAttempts = 10for ([int]$attempt = 1; $attempt -le $maxAttempts; $attempt++) {
try {[array]$foundKey = Get-ItemProperty -Path $keys.PsPath -ea SilentlyContinue | ?{$.DisplayName -like "*"}; $success = $TRUE;}
catch {
foreach ($key in $keys){
try{Get-ItemProperty $key.PsPath > $null}
catch{$badKey = $key.PsPath}
}
Write-Warning "Found bad key: $badKey"
[array]$keys = Get-ChildItem -Path @($hkcu, $hklm, $hklmWow) -ea SilentlyContinue | ?{$badKey -NotContains $
.PsPath}
}
if ($success) {break;}
}

details about why in #92
#92
general solution in #198
#198, and will be
implemented specifically for this pkg in #222
#222

As you may have noticed, this bug affects many packages on chocolatey.org
and most all install packages I maintain. This will be slowly snuffed out
as old packages get updated. For now, the workaround is to remove the
offending application, or, if you need the offending software installed,
fix the bad registry key.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#167 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAgGN6AttrZ7GsLo4_KbAyB-bxsE6w-aks5qNFy6gaJpZM4H6tkm
.

@tunisiano187
Copy link
Contributor

@gep13 , this plugin isn't mainained anymore (last update 2016)
and the problem isn't really related to the package but more to the plugin itself.
so i think you can close it too.
Thank you

@gep13
Copy link
Collaborator

gep13 commented Aug 2, 2020

@tunisiano187 👍

@gep13 gep13 closed this as completed Aug 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants