diff --git a/extensions/chocolatey-core.extension/extensions/Get-AppInstallLocation.ps1 b/extensions/chocolatey-core.extension/extensions/Get-AppInstallLocation.ps1 index ef28520228a..d0f62a6e73a 100644 --- a/extensions/chocolatey-core.extension/extensions/Get-AppInstallLocation.ps1 +++ b/extensions/chocolatey-core.extension/extensions/Get-AppInstallLocation.ps1 @@ -60,7 +60,7 @@ function Get-AppInstallLocation { $dirs = $Env:ProgramFiles, "$Env:ProgramFiles\*\*" if (Get-ProcessorBits 64) { $dirs += ${ENV:ProgramFiles(x86)}, "${ENV:ProgramFiles(x86)}\*\*" } Write-Verbose "Trying Program Files with 2 levels depth: $dirs" - $location = (ls $dirs | ? {$_.PsIsContainer}) -match $AppNamePattern | select -First 1 | % {$_.FullName} + $location = (Get-ChildItem $dirs | ? {$_.PsIsContainer}) -match $AppNamePattern | select -First 1 | % {$_.FullName} if (is_dir $location) { return strip $location } Write-Verbose "Trying native commands on PATH" @@ -69,7 +69,7 @@ function Get-AppInstallLocation { $appPaths = "\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths" Write-Verbose "Trying Registry: $appPaths" - $location = (ls "HKCU:\$appPaths", "HKLM:\$appPaths") -match $AppNamePattern | select -First 1 + $location = (Get-ChildItem "HKCU:\$appPaths", "HKLM:\$appPaths") -match $AppNamePattern | select -First 1 if ($location) { $location = Split-Path $location } if (is_dir $location) { return strip $location } diff --git a/extensions/chocolatey-core.extension/extensions/chocolatey-core.psm1 b/extensions/chocolatey-core.extension/extensions/chocolatey-core.psm1 index ee4217412cc..947856f311f 100644 --- a/extensions/chocolatey-core.extension/extensions/chocolatey-core.psm1 +++ b/extensions/chocolatey-core.extension/extensions/chocolatey-core.psm1 @@ -2,9 +2,9 @@ # Include file names that start with capital letters, ignore others $ScriptRoot = Split-Path $MyInvocation.MyCommand.Definition -$pre = ls Function:\* -ls "$ScriptRoot\*.ps1" | ? { $_.Name -cmatch '^[A-Z]+' } | % { . $_ } -$post = ls Function:\* +$pre = Get-ChildItem Function:\* +Get-ChildItem "$ScriptRoot\*.ps1" | ? { $_.Name -cmatch '^[A-Z]+' } | % { . $_ } +$post = Get-ChildItem Function:\* $funcs = compare $pre $post | select -Expand InputObject | select -Expand Name $funcs | ? { $_ -cmatch '^[A-Z]+'} | % { Export-ModuleMember -Function $_ }