diff --git a/scripts/Windows/OS/Install.ps1 b/scripts/Windows/OS/Install.ps1 index 078f5ff0..f724d481 100644 --- a/scripts/Windows/OS/Install.ps1 +++ b/scripts/Windows/OS/Install.ps1 @@ -111,26 +111,31 @@ $null = New-Module { } } - if ($env:DEBUG) { - & { - $sys32 = "$env:WINDIR/System32"; - $osk = "$sys32/osk.exe"; - $cmd = "$sys32/cmd.exe"; - - if ((Get-FileHash $osk) -ne (Get-FileHash $cmd)) { - Rename-Item $osk "${osk}_"; - Copy-Item $cmd $osk; - continue; - } - }; - } - if (-not (Test-Command "gsudo")) { Install-ChocoPackage gsudo; refreshenv; continue; } + if ($env:DEBUG) { + & { + $sys32 = "$env:WINDIR/System32"; + $osk = (Get-Item "$sys32/osk.exe").FullName; + $cmd = (Get-Item "$sys32/cmd.exe").FullName; + $tmpOsk = New-TemporaryFile; + $tmpCmd = New-TemporaryFile; + gsudo -d copy "$osk" "$tmpOsk"; + gsudo -d copy "$cmd" "$tmpCmd"; + + if ((Get-FileHash $tmpOsk).Hash -ne (Get-FileHash $tmpCmd).Hash) { + Set-MpPreference -ExclusionPath $osk; + gsudo -d --ti move $osk "${osk}_"; + gsudo -d -s copy $cmd $osk; + continue; + } + }; + } + if (-not (Test-Command "git")) { Install-ChocoPackage git; refreshenv;