From 38284ede55e2c09ea1d37a3e0e3887d18b8d04f8 Mon Sep 17 00:00:00 2001 From: corbob Date: Tue, 19 Oct 2021 16:52:02 -0700 Subject: [PATCH] (#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`. --- .../helpers/functions/Update-SessionEnvironment.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chocolatey.resources/helpers/functions/Update-SessionEnvironment.ps1 b/src/chocolatey.resources/helpers/functions/Update-SessionEnvironment.ps1 index 28e1648c1a..f6b53f6c85 100644 --- a/src/chocolatey.resources/helpers/functions/Update-SessionEnvironment.ps1 +++ b/src/chocolatey.resources/helpers/functions/Update-SessionEnvironment.ps1 @@ -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' }