Fix permission issues when enabling Win hack
This commit is contained in:
parent
8e7aeb9161
commit
34919991ae
1 changed files with 19 additions and 14 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue