Windows components
Author: Fishweasel (talk, contrib) |
Description
The following script example demonstrates how to Install/Uninstall windows XP components with NSIS. IIS (built in web/ftp server) is used in this example, with a few IIS sub_components. There is extensive documentation for other components and sub-components at the MS Website[1].
Windows XP uses a program called sysocmgr.exe to install components. Using an answer file it is possible to specify which components you need to add/remove.
The Code
ExecWait '"sysocmgr.exe" /C /i:sysoc.inf /u:C:\temp\answerfile.txt'
there are multiple switches that can be used as part of sysocmgr which include :
/i:<master_oc_inf>- (required) Specifies the name of the master inf.
/u:<unattend_spec>- specifies unattended operation parameters.
/c: - disalow cancel during final installation phase.
/x - suppress the 'initializing' banner.
/q - for use with /u: Runs unattended without UI.
/w - for use with /u: If reboot is required, prompt user instead of auto reboot
When using /u: for unattended you must specify an answer file with the parts you need along with its relevant path. Again, the MS website [2] is the best place to go - as different components would need different sub components.
The answer file would look something like this :
Answerfile.txt
[Components] iis_common=on iis_ftp=on iis_inetmer=on iis_smtp=on iis_internetdataconnector=on iis_www=on inetprint=on [InternetServer]
In this case the answer file stipulates that we only want to add the listed iis components and internet server.
Uninstalling Components
The exact same command and switches can be used to uninstall components. All that needs to be done is the answer file should specify <component>=off. For example
[Components] iis_common=off iis_ftp=off iis_inetmer=off iis_smtp=off iis_internetdataconnector=off iis_www=off inetprint=off [InternetServer]
License
This example is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this code.
Permission is granted to anyone to use this example for any purpose, including commercial applications, and to alter it and redistribute it freely.