Difference between revisions of "Windows XP SP3"
(Added check condition so that it will bypass on machines with SP3 preinstalled.) |
(Made package language-independent) |
||
Line 1: | Line 1: | ||
− | Silent installer for Windows XP Service Pack 3 | + | Silent installer for Windows XP Service Pack 3. |
Checks uninstall information and registry key "CSDVersion" so that it will not try to install on a machine with SP3 factory preinstalled, which typically does not show "Windows XP Service Pack 3" in the Add/Remove program application. | Checks uninstall information and registry key "CSDVersion" so that it will not try to install on a machine with SP3 factory preinstalled, which typically does not show "Windows XP Service Pack 3" in the Add/Remove program application. | ||
Technet page for Service Pack 3: http://technet.microsoft.com/en-us/windowsxp/0a5b9b10-17e3-40d9-8d3c-0077c953a761.aspx | Technet page for Service Pack 3: http://technet.microsoft.com/en-us/windowsxp/0a5b9b10-17e3-40d9-8d3c-0077c953a761.aspx | ||
− | |||
<source lang="xml"> | <source lang="xml"> | ||
Line 10: | Line 9: | ||
<packages> | <packages> | ||
− | <package id="WinXP-SP3 | + | <package id="WinXP-SP3" name="Windows XP Service Pack 3" revision="1" reboot="true" priority="0"> |
<check type="logical" condition="or"> | <check type="logical" condition="or"> | ||
<check type="registry" condition="equals" path="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName" value="Microsoft Windows 2000" /> | <check type="registry" condition="equals" path="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName" value="Microsoft Windows 2000" /> | ||
Line 16: | Line 15: | ||
<check type="uninstall" condition="exists" path="Windows XP Service Pack 3" /> | <check type="uninstall" condition="exists" path="Windows XP Service Pack 3" /> | ||
</check> | </check> | ||
− | <install cmd='%SOFTWARE%\ServicePacks\ | + | <install cmd='%SOFTWARE%\ServicePacks\install-localized-SP3.cmd'> |
<exit code="0" /> | <exit code="0" /> | ||
<exit code="3010" /> | <exit code="3010" /> | ||
Line 26: | Line 25: | ||
</package> | </package> | ||
</packages> | </packages> | ||
+ | </source> | ||
+ | |||
+ | Instead of calling the Service Pack installer straight from within the WPKG package, we call a batch-file which determines the system-locale and executes the localized service pack installer (as diferent locales won't install). | ||
+ | This is the possible source code of that batch-files <code>install-localized-SP3.cmd</code> (You can of course add/delete languages to your needs; see http://www.microsoft.com/globaldev/reference/lcid-all.mspx for a complete list) | ||
+ | |||
+ | <source lang="dos"> | ||
+ | @echo off | ||
+ | |||
+ | :detect | ||
+ | for /f "Skip=1 Tokens=3*" %%i in ('reg QUERY "hklm\system\controlset001\control\nls\language" /v Installlanguage') do set language=%%i | ||
+ | |||
+ | :: Dutch - Belgium | ||
+ | if "%language%" == "0813" ( | ||
+ | set LANG=NLD | ||
+ | goto select | ||
+ | ) | ||
+ | :: Dutch - Netherlands | ||
+ | if "%language%" == "0413" ( | ||
+ | set LANG=NLD | ||
+ | goto select | ||
+ | ) | ||
+ | :: English - United States | ||
+ | if "%language%" == "0409" ( | ||
+ | set LANG=ENU | ||
+ | goto select | ||
+ | ) | ||
+ | :select | ||
+ | echo Found Language: %LANG% | ||
+ | echo installing %SOFTWARE%\ServicePacks\WindowsXP-KB936929-SP3-x86-%LANG%.exe /quiet /norestart | ||
+ | %SOFTWARE%\ServicePacks\WindowsXP-KB936929-SP3-x86-%LANG%.exe /quiet /norestart | ||
+ | exit /B %ERRORLEVEL% | ||
</source> | </source> | ||
Line 70: | Line 100: | ||
</pre> | </pre> | ||
− | + | ---- | |
[[Category: Silent Installers]] | [[Category: Silent Installers]] | ||
[[Category: Silent installers for Windows Hotfixes]] | [[Category: Silent installers for Windows Hotfixes]] | ||
[[category:Security Advisories]] | [[category:Security Advisories]] |
Latest revision as of 10:37, 31 December 2008
Silent installer for Windows XP Service Pack 3.
Checks uninstall information and registry key "CSDVersion" so that it will not try to install on a machine with SP3 factory preinstalled, which typically does not show "Windows XP Service Pack 3" in the Add/Remove program application.
Technet page for Service Pack 3: http://technet.microsoft.com/en-us/windowsxp/0a5b9b10-17e3-40d9-8d3c-0077c953a761.aspx
<?xml version="1.0" encoding="UTF-8"?>
<packages>
<package id="WinXP-SP3" name="Windows XP Service Pack 3" revision="1" reboot="true" priority="0">
<check type="logical" condition="or">
<check type="registry" condition="equals" path="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName" value="Microsoft Windows 2000" />
<check type="registry" condition="equals" path="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CSDVersion" value="Service Pack 3" />
<check type="uninstall" condition="exists" path="Windows XP Service Pack 3" />
</check>
<install cmd='%SOFTWARE%\ServicePacks\install-localized-SP3.cmd'>
<exit code="0" />
<exit code="3010" />
</install>
<remove cmd='%WINDIR%\$NtServicePackUninstall$\spuninst\spuninst.exe /quiet /norestart'>
<exit code="0" />
<exit code="3010" />
</remove>
</package>
</packages>
Instead of calling the Service Pack installer straight from within the WPKG package, we call a batch-file which determines the system-locale and executes the localized service pack installer (as diferent locales won't install).
This is the possible source code of that batch-files install-localized-SP3.cmd
(You can of course add/delete languages to your needs; see http://www.microsoft.com/globaldev/reference/lcid-all.mspx for a complete list)
@echo off
:detect
for /f "Skip=1 Tokens=3*" %%i in ('reg QUERY "hklm\system\controlset001\control\nls\language" /v Installlanguage') do set language=%%i
:: Dutch - Belgium
if "%language%" == "0813" (
set LANG=NLD
goto select
)
:: Dutch - Netherlands
if "%language%" == "0413" (
set LANG=NLD
goto select
)
:: English - United States
if "%language%" == "0409" (
set LANG=ENU
goto select
)
:select
echo Found Language: %LANG%
echo installing %SOFTWARE%\ServicePacks\WindowsXP-KB936929-SP3-x86-%LANG%.exe /quiet /norestart
%SOFTWARE%\ServicePacks\WindowsXP-KB936929-SP3-x86-%LANG%.exe /quiet /norestart
exit /B %ERRORLEVEL%
Still to be investigated which is the best command line switches combination. Available command line switches are:
/help /quiet /passive /norestart /forcerestart /warnrestart[:<seconds>] /promptrestart /overwriteoem /nobackup /forceappsclose /integrate:<full path> /d:<path> /log:<full path>
UninstallString string value in the registry key "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\Windows XP Service Pack" reports "c:\windows\$NtServicePackUninstall$\spuninst\spuninst.exe", didn't check if it works as expected.
Spuninst.exe available command line switches are:
/help /quiet /passive /norestart /forcerestart /warnrestart[:<seconds>] /promptrestart /forceappsclose /log:<full path>