chocolatey / cChoco

Community resource to manage Chocolatey
Apache License 2.0
154 stars 99 forks source link

Import-Clixml returning empty so no software found #133

Closed SylvainMartel closed 5 years ago

SylvainMartel commented 5 years ago

I cannot find out why, but the line https://github.com/chocolatey/cChoco/blob/aed59762c625375eeaa57c9c3a3b99991af16986/DSCResources/cChocoPackageInstall/cChocoPackageInstall.psm1#L442

return an empty value when run by the LCM agent. So it always report that the software was not installed when it was.

If I run the function Get-ChocoInstalledPackage manually in an admin shell, the import-clixml works and the function IsPackageInstalled returns True correctly Any reason why it fails when run from the LCM?

Also, very very often, the condition https://github.com/chocolatey/cChoco/blob/aed59762c625375eeaa57c9c3a3b99991af16986/DSCResources/cChocoPackageInstall/cChocoPackageInstall.psm1#L441 is false, so it never even try to do the Import-Cli so$res is not even populated. What is the purpose of that time check?

SylvainMartel commented 5 years ago

Closing this, the problem was a trailing space on the product name... It had no impact on the install, but it had when came the time to compare if it was installed.