Passing arguments to a Windows service installer class using in installutil

Passing parameters to an implementation of the Installer class of a Windows Service executable when installed by the installutil command line tool is pretty easy.

Simply add each parameter and value to the command line, like:

installutil.exe /param1=val1 /param2=val2 serviceexecutable.exe

Note: The parameter arguments needs to be in front of the executable. Otherwise the values will not be passed to the Installer class context.

The installer class implementation can access the arguments conveniently by the context.parameters collection.

image

Advertisements