Skip to content

Commit

Permalink
(chocolatey#2398) Restore PowerShell v2 support
Browse files Browse the repository at this point in the history
PowerShell v2 doesn't recognize `-notin` as it was introduced in v3. This changes to use `-notcontains` which was introduced in v2 and works similar to `-notin`.
  • Loading branch information
corbob committed Oct 20, 2021
1 parent b288cd1 commit 38284ed
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ None

#ordering is important here, $user should override $machine...
$ScopeList = 'Process', 'Machine'
if ($userName -notin 'SYSTEM', "${env:COMPUTERNAME}`$") {
if ('SYSTEM', "${env:COMPUTERNAME}`$" -notcontains $userName) {
# but only if not running as the SYSTEM/machine in which case user can be ignored.
$ScopeList += 'User'
}
Expand Down

0 comments on commit 38284ed

Please sign in to comment.