Skip to content

Commit de7d1a8

Browse files
committed
(#2398) Restore PowerShell v2 support
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`.
1 parent b288cd1 commit de7d1a8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/chocolatey.resources/helpers/functions/Update-SessionEnvironment.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ None
6767

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

0 commit comments

Comments
 (0)