If any directory gets Access Denied (due to antivirus), the current function will fail. Antivirus does not allow directory scan for its own directory under "C:\Program Files**" - "C:\Program Files\AntivirusSoftware". This makes all packages that try to install using using this extension also fail since the app can't complete its registration.
Expected Behavior
Package/Application installs completes successfully.
Current Behavior
Package/Application installs fail when using this function.
Possible Solution
The fix below works but there may be a better method to scan dirs.
For Get-AppInstallLocation.ps1:
line 63 of Get-AppInstallLocation.ps1
Write-Verbose "Trying Program Files with 2 levels depth: $dirs"
#$dirs = $Env:ProgramFiles, "$Env:ProgramFiles\*\*"
#if (Get-ProcessorBits 64) { $dirs += ${ENV:ProgramFiles(x86)}, "${ENV:ProgramFiles(x86)}\*\*" }
#$location = (ls $dirs | ? {$_.PsIsContainer}) -match $AppNamePattern | select -First 1 | % {$_.FullName}
$dirs = @($Env:ProgramFiles)
if (Get-ProcessorBits 64) { $dirs += ${ENV:ProgramFiles(x86)}}
$location = (ls $dirs -filter '*' -depth 2 | ? {$_.PsIsContainer}) -match $AppNamePattern | select -First 1 | % {$_.FullName}
Steps to Reproduce (for bugs)
- Create directory under C:\Program Files\AntivirusApp
- Revoke all permissions to that directory to simulate "Access Denied" (such as to simulate antivirus blocking all read access)
- Attempt app install that uses Chocolatey Core extension -- choco install notepadplusplus
Context
Unable to install any packages using this extension
If any directory gets Access Denied (due to antivirus), the current function will fail. Antivirus does not allow directory scan for its own directory under "C:\Program Files**" - "C:\Program Files\AntivirusSoftware". This makes all packages that try to install using using this extension also fail since the app can't complete its registration.
Expected Behavior
Package/Application installs completes successfully.
Current Behavior
Package/Application installs fail when using this function.
Possible Solution
The fix below works but there may be a better method to scan dirs.
For Get-AppInstallLocation.ps1:
line 63 of Get-AppInstallLocation.ps1
Steps to Reproduce (for bugs)
Context
Unable to install any packages using this extension