Tom Squires
Tom Squires

Reputation: 9286

Passing a parameter to a service installer via installutil

I'm trying to write a power shell script to install a service but the service requires an extra command line paramiter passed to it. Im having trouble getting this passed over.

Here is the service installer that uses the parameter;

this.serviceInstaller.ServiceName = string.Format("My brill service {0}",this.Context.Parameters["environment"])

And I have tried passing the paramiter in two ways;

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe "C:\foo\bar.exe /environment:tomtest"

(this gives the error "invalid directory on url")

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe /environment:tomtest "C:\foo\bar.exe"

(this just dosent change the service name)

Any ideas? Thanks

Upvotes: 8

Views: 11530

Answers (1)

Tom Squires
Tom Squires

Reputation: 9286

I was very close. An equals sign = has to be used to assign the value of the parameter (not a colon :):

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe /environment=tomtest "C:\foo\bar.exe"

Upvotes: 8

Related Questions