Archive: Install a Windows Component


Install a Windows Component
hi guys,
before installing my own application, I need to verify the installation of some Windows Components (Control Panel\Add Remove Programs\Add Remove Windows Components). If they are not already installed I have to start the corresponding setup procedure.
is there a way to start the setup of a needed Windows Component?
thanks in advance


If you know the exact uninstall registry entry for each component that you want to check, you may want to do it by reading the registry.
If one or more components not already installed, your main options should be either include them in your package/extract in $PLUGINSDIR and install, or download and install. (Both options are regular NSIS feaures).
Also, you may prompt users to install required components before continue with your installation.


To add / remove windows components use 'sysocmgr.exe'

depending on what you need to install / remove depends on switches and answer files, for example my script needs to install IIS:

sysocmgr.exe /i:sysoc.inf /u:c:\temp\IIS_answer.txt

(the above holds a switch /u to make it unattended so no interraction required)

IIS_answer.txt holds the components i wish to have :


[Components]
iis_common=on
iis_ftp=on
iis_inetmer=on
iis_smtp=on
iis_internetdataconnector=on
iis_www=on
inetprint-on

[InternetServer]


there is extensive documentation on MS support pages - do a search for unattended windows components.

Hope that helps

Originally posted by fishweasel
To add / remove windows components use 'sysocmgr.exe'

depending on what you need to install / remove depends on switches and answer files, for example my script needs to install IIS:

sysocmgr.exe /i:sysoc.inf /u:c:\temp\IIS_answer.txt

(the above holds a switch /u to make it unattended so no interraction required)

IIS_answer.txt holds the components i wish to have :


[Components]
iis_common=on
iis_ftp=on
iis_inetmer=on
iis_smtp=on
iis_internetdataconnector=on
iis_www=on
inetprint-on

[InternetServer]


there is extensive documentation on MS support pages - do a search for unattended windows components.

Hope that helps
Gee! Could you pass it to NSIS script and post a wiki page as well?

thanks fishweasel!
I found that solution yesterday, searching on Google, but I forgot to post it here :) Now I have to know if there are differences among 2k/XP/2k3 on services I need..


Not sure about passing direct to nsis - maybe ExecToStack ??
I personally call the sysoc from a bat file and have the answer file included in the section. I will look into a cleaner way of doing it from the script (makes my installer more tidy anyway) and i shall add it to nsis wiki this week. Should i put it in code examples ?


Originally posted by fishweasel
Not sure about passing direct to nsis - maybe ExecToStack ??
I personally call the sysoc from a bat file and have the answer file included in the section. I will look into a cleaner way of doing it from the script (makes my installer more tidy anyway) and i shall add it to nsis wiki this week. Should i put it in code examples ?
That would be very useful for many users, and for me as well :) Looking forward to grab it.
I guess code examples is the right place to go.

I did a little testing and it runs no problem from NSIS
but you still require an answer file - which thinking about is pretty neat - you can either have the one you specify or use install options to create a more tailored answer file during installation (not needed in mine so i didnt mess with this - but drop boxes radio buttons etc would be easy to do)


ExecWait '"sysocmgr.exe" /C /i:sysoc.inf /u:C:\temp\answerfile.txt'


I will have a play around to see if i can use the likes of $INSTDIR or $pluginsdir with this, and also to see if i can pass components direct to the command line (looks unlikely)
but for now its friday night and im off home :p

edit : still trying to figure out how to write wiki page and have it appear in code example category :(

edit : still trying to figure out how to write wiki page and have it appear in code example category
http://nsis.sourceforge.net/Starting_a_new_page

Also you may take a look at other pages (click edit tab)