Expanding where alias to Where-Object in Reset-PWSHSystemPath.ps1 (#14113)

This commit is contained in:
Matthew J. DeGarmo 2020-11-18 23:25:52 -06:00 committed by GitHub
parent c9df1c1810
commit c59fcf09c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,7 +53,7 @@ ForEach ($PathScopeItem in $PathScope)
{
$AssembledNewPath = $NewPath = ''
#From the current path scope. retrieve the array of paths that match the pathspec of PowerShell (to use as a filter)
$pathstoremove = @([Environment]::GetEnvironmentVariable("PATH","$PathScopeItem").split(';') | where { $_ -ilike "*\Program Files\Powershell\6*"})
$pathstoremove = @([Environment]::GetEnvironmentVariable("PATH","$PathScopeItem").split(';') | Where-Object { $_ -ilike "*\Program Files\Powershell\6*"})
If (!$RemoveAllOccurences)
{
#If we are not removing all occurances of PowerShell paths, then remove the highest sorted path from the filter