Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <# ::
- @echo off & setlocal
- :: CHECK FOR ADMIN
- net file >nul 2>&1
- call :checkErr "Please run as admin."
- :: REMOVE FENCES NATIVE IMAGE
- "%systemroot%\Microsoft.NET\Framework64\v4.0.30319\ngen.exe" uninstall Fences
- :: DOWNLOAD DUMMY DLL (open sourced by me, check repo for code)
- if not exist "%systemroot%\womtrust.dll" (
- curl -LR https://github.com/cevoj35/DummyWomtrust/releases/download/v1.0/womtrust.dll > "%systemroot%\womtrust.dll"
- )
- call :checkErr "Download failed. Please check your internet connection."
- powershell -noprofile -nologo "iex (${%~f0} | out-string)"
- goto:eof
- :checkErr
- if %errorlevel%==0 (goto :eof)
- echo %~1
- pause >nul
- exit /b 1
- ::#>
- <# -- LIBRARY -- #>
- function Expand-EnvVar($Path) {
- return [System.Environment]::ExpandEnvironmentVariables($Path)
- }
- New-Alias -Name ee -Value Expand-EnvVar
- function Edit-FileBytes($Path, $Modifications) {
- $Path = ee "$Path"
- $bytes = [System.IO.File]::ReadAllBytes($Path)
- foreach ($mod in $Modifications) {
- if ($mod -match '(\d+)=(\d+)') {
- $bytes[$matches[1]] = $matches[2]
- }
- }
- [System.IO.File]::WriteAllBytes($Path, $bytes)
- }
- <# -- KILL PROCESSES -- #>
- taskkill /f /im explorer.exe 2>$null
- taskkill /f /im Fences.exe 2>$null
- $procpath = ee "%programfiles(x86)%\Stardock\Fences"
- Get-WmiObject Win32_Process | ForEach-Object {
- $process = $_
- $commandLine = $process.CommandLine
- # check if the command line contains the specific directory
- if ($commandLine -and $commandLine.Contains($procpath)) {
- Stop-Process -Id $process.ProcessId -Force
- Write-Output "Terminated process with command line: $commandLine"
- }
- }
- <# -- FILES -- #>
- Edit-FileBytes '%programfiles(x86)%\Stardock\Fences\DesktopDock.dll' '368=2','369=51','1064226=111'
- Edit-FileBytes '%programfiles(x86)%\Stardock\Fences\DesktopDock64.dll' '360=96','361=111','324723=14','1140594=111','1140596=109'
- Edit-FileBytes '%programfiles(x86)%\Stardock\Fences\Fences.exe' '216=73','217=198','1199085=111','1199086=109'
- Edit-FileBytes '%programfiles(x86)%\Stardock\Fences\SdAppServices.dll' '361=135','338549=14','339431=14'
- Edit-FileBytes '%programfiles(x86)%\Stardock\Fences\SdAppServices_x64.dll' '376=66','377=204','391266=14','392162=14','393058=14','393954=14','394850=14','395746=14','401944=14'
- Edit-FileBytes '%programfiles(x86)%\Stardock\Fences\Stardock.ApplicationServices.dll' '216=135','217=170','24251=111','24252=109'
- Write-Host Complete! Please reboot.
- start explorer.exe
- pause
Advertisement
Comments
-
- does this bat file gives you a full fences app from a trial one?
-
- Yes
Add Comment
Please, Sign In to add comment
Advertisement