Script to remove german update files

Script to remove german update files

Postby sao » 13.02.2014, 09:32

As our internet connection is limited downloading German updates can be quite hurtful especially as we only need English updates. I therefore created a script RemoveGermanLanguageSupport.cmd (see below) which removes those updates automatically instead of removing them manually one by one. I am aware that those static files will be overwritten each time there is a new version of wsusoffline. I think with such a script it is not a big deal though to run it quickly to get back to status quo after wsusoffline has been updated.

RemoveGermanLanguageSupport.cmd
Code: Select all
@echo off

verify other 2>nul
setlocal enableextensions
if errorlevel 1 goto NoExtensions

cd /D "%~dp0"

set LANG=deu

rem *** Remove support for %LANG% from .NET URL files ***
if /i "%1" NEQ "/quiet" echo Removing support for %LANG% from .NET URL files...
for %%i in (x86 x64) do (
  for /F %%j in (..\static\StaticDownloadLinks-dotnet-%%i-%LANG%.txt) do (
    if exist ..\static\StaticDownloadLinks-dotnet.txt (
      ren ..\static\StaticDownloadLinks-dotnet.txt StaticDownloadLinks-dotnet.tmp
      %SystemRoot%\System32\findstr.exe /L /I /V "%%~nxj" ..\static\StaticDownloadLinks-dotnet.tmp>..\static\StaticDownloadLinks-dotnet.txt
      del ..\static\StaticDownloadLinks-dotnet.tmp
    )
    if exist ..\static\StaticDownloadLinks-dotnet-%%i-glb.txt (
      ren ..\static\StaticDownloadLinks-dotnet-%%i-glb.txt StaticDownloadLinks-dotnet-%%i-glb.tmp
      %SystemRoot%\System32\findstr.exe /L /I /V "%%~nxj" ..\static\StaticDownloadLinks-dotnet-%%i-glb.tmp>..\static\StaticDownloadLinks-dotnet-%%i-glb.txt
      del ..\static\StaticDownloadLinks-dotnet-%%i-glb.tmp
    )
  )
)
rem *** Remove support for %LANG% from IEx URL files ***
if /i "%1" NEQ "/quiet" echo Removing support for %LANG% from IEx URL files...
for %%i in (x86 x64) do (
  for /F %%j in (..\static\StaticDownloadLinks-ie8-w60-%%i-%LANG%.txt) do (
    if exist ..\static\StaticDownloadLinks-w60-%%i-glb.txt (
      ren ..\static\StaticDownloadLinks-w60-%%i-glb.txt StaticDownloadLinks-w60-%%i-glb.tmp
      %SystemRoot%\System32\findstr.exe /L /I /V "%%~nxj" ..\static\StaticDownloadLinks-w60-%%i-glb.tmp>..\static\StaticDownloadLinks-w60-%%i-glb.txt
      del ..\static\StaticDownloadLinks-w60-%%i-glb.tmp
    )
  )
  for %%j in (..\static\StaticDownloadLinks-w60-%%i-glb.txt) do if %%~zj==0 del %%j
  for /F %%j in (..\static\StaticDownloadLinks-ie9-w61-%%i-%LANG%.txt) do (
    if exist ..\static\StaticDownloadLinks-w61-%%i-glb.txt (
      ren ..\static\StaticDownloadLinks-w61-%%i-glb.txt StaticDownloadLinks-w61-%%i-glb.tmp
      %SystemRoot%\System32\findstr.exe /L /I /V "%%~nxj" ..\static\StaticDownloadLinks-w61-%%i-glb.tmp>..\static\StaticDownloadLinks-w61-%%i-glb.txt
      del ..\static\StaticDownloadLinks-w61-%%i-glb.tmp
    )
  )
)
rem *** Remove support for %LANG% from MSSE URL files ***
if /i "%1" NEQ "/quiet" echo Removing support for %LANG% from MSSE URL files...
for %%i in (x86 x64) do (
  if exist ..\static\StaticDownloadLinks-msse-%%i-%LANG%.txt (
    for /F %%j in (..\static\StaticDownloadLinks-msse-%%i-%LANG%.txt) do (
      if exist ..\static\StaticDownloadLinks-msse-%%i-glb.txt (
        ren ..\static\StaticDownloadLinks-msse-%%i-glb.txt StaticDownloadLinks-msse-%%i-glb.tmp
        %SystemRoot%\System32\findstr.exe /L /I /V "%%~nxj" ..\static\StaticDownloadLinks-msse-%%i-glb.tmp>..\static\StaticDownloadLinks-msse-%%i-glb.txt
        del ..\static\StaticDownloadLinks-msse-%%i-glb.tmp
      )
    )
  )
)
goto EoF

:NoExtensions
echo.
echo ERROR: No command extensions / delayed variable expansion available.
echo.
goto EoF

:EoF
endlocal


I assume that such a script would be helpful for other users as well and therefore wanted to ask whether it could be included in the official wsusoffline archive? Let me know what you think.

Cheers,
Oliver
sao
 
Posts: 4
Joined: 13.02.2014, 09:16

Re: Script to remove german update files

Postby WSUSUpdateAdmin » 19.02.2014, 09:38

Hi!

:arrow: http://trac.wsusoffline.net/browser/trunk (r559).

Thanks & regards
Torsten Wittrock
WSUSUpdateAdmin
Administrator
 
Posts: 2245
Joined: 07.07.2009, 14:38


Return to Anregungen / Suggestions

Who is online

Users browsing this forum: No registered users and 197 guests