service.exe /install?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Phill W.

    service.exe /install?

    Is it [still] possible to write a Windows Service such that it can
    install /itself/ based on a command-line argument?

    I've got my Service (in VB'2005) with its own, integral Installer which
    /works/ when fed into InstallUtil but, for .. "Reasons" .. I'd prefer to
    "drive" this all from the executable. I can't work out how to "invoke"
    the installer[s] from Sub Main of the service. I keep getting
    NullReferenceEx ceptions from inside the ServiceInstalle r's Install method:

    ' Create my service's installer (added via the IDE)
    ' This invokes initializeCompo nent(), which adds
    ' /two/ Installers (ServiceInstall er and ServiceProcessI nstaller)
    Dim installer as New ProjectInstalle r()

    ' Something to hold "state" in
    Dim state as IDictionary = new Hashtable()

    Try
    If bInstall Then
    installer.Insta ll(state) <- BOOM!

    NullReferencEex ception
    at System.ServiceP rocess.ServiceI nstaller.Instal l(IDictionary stateSaver)
    at System.Configur ation.Install.I nstaller.Instal l(IDictionary stateSaver)
    at (namespace) ... Program.SelfIns tallService(Boo lean install)
    in (source file) ...\\Program.vb :line 68

    Any suggestions?

    TIA,
    Phill W.
  • Mr. Arnold

    #2
    Re: service.exe /install?


    "Phill W." <p-.-a-.-w-a-r-d-@-o-p-e-n-.-a-c-.-u-kwrote in message
    news:fq3pc0$ir3 $1@south.jnrs.j a.net...
    Any suggestions?
    I've got my Service (in VB'2005) with its own, integral Installer which
    /works/ when fed into InstallUtil

    Comment

    • sloan

      #3
      Re: service.exe /install?



      Ignore the msmq stuff... and check the install.bat and uninstall.bat stuff.

      ...



      "Phill W." <p-.-a-.-w-a-r-d-@-o-p-e-n-.-a-c-.-u-kwrote in message
      news:fq3pc0$ir3 $1@south.jnrs.j a.net...
      Is it [still] possible to write a Windows Service such that it can install
      /itself/ based on a command-line argument?
      >
      I've got my Service (in VB'2005) with its own, integral Installer which
      /works/ when fed into InstallUtil but, for .. "Reasons" .. I'd prefer to
      "drive" this all from the executable. I can't work out how to "invoke"
      the installer[s] from Sub Main of the service. I keep getting
      NullReferenceEx ceptions from inside the ServiceInstalle r's Install method:
      >
      ' Create my service's installer (added via the IDE)
      ' This invokes initializeCompo nent(), which adds
      ' /two/ Installers (ServiceInstall er and ServiceProcessI nstaller)
      Dim installer as New ProjectInstalle r()
      >
      ' Something to hold "state" in
      Dim state as IDictionary = new Hashtable()
      >
      Try
      If bInstall Then
      installer.Insta ll(state) <- BOOM!
      >
      NullReferencEex ception
      at System.ServiceP rocess.ServiceI nstaller.Instal l(IDictionary stateSaver)
      at System.Configur ation.Install.I nstaller.Instal l(IDictionary stateSaver)
      at (namespace) ... Program.SelfIns tallService(Boo lean install)
      in (source file) ...\\Program.vb :line 68
      >
      Any suggestions?
      >
      TIA,
      Phill W.

      Comment

      • Phill W.

        #4
        Re: service.exe /install?

        Mr. Arnold wrote:
        >
        "Phill W." <p-.-a-.-w-a-r-d-@-o-p-e-n-.-a-c-.-u-kwrote in message
        news:fq3pc0$ir3 $1@south.jnrs.j a.net...
        >
        >Any suggestions?
        >
        I've got my Service (in VB'2005) with its own, integral Installer which
        /works/ when fed into InstallUtil
        I thought that one would come back on me.

        Of course I /could/ use InstallUtil.exe - but only if the DOS Batch
        script that's kicking this "installati on" off can /locate/ the correct
        (or latest) version /of/ InstallUtil.exe , wherever that might be on the
        machine. (You see; it'd be so much easier if the exe is running /in/
        the right Framework already and I could just /invoke/ its own installer).

        Regards,
        Phill W.

        Comment

        • Chris Dunaway

          #5
          Re: service.exe /install?

          On Feb 28, 7:02 am, "Phill W." <p-.-a-.-w-a-r...@-o-p-e-n-.-a-c-.-u-k>
          wrote:
          Mr. Arnold wrote:
          >
          "Phill W." <p-.-a-.-w-a-r...@-o-p-e-n-.-a-c-.-u-kwrote in message
          news:fq3pc0$ir3 $1@south.jnrs.j a.net...
          >
          Any suggestions?
          >
          I've got my Service (in VB'2005) with its own, integral Installer which
          /works/ when fed into InstallUtil
          >
          I thought that one would come back on me.
          >
          Of course I /could/ use InstallUtil.exe - but only if the DOS Batch
          script that's kicking this "installati on" off can /locate/ the correct
          (or latest) version /of/ InstallUtil.exe , wherever that might be on the
          machine. (You see; it'd be so much easier if the exe is running /in/
          the right Framework already and I could just /invoke/ its own installer).
          >
          Regards,
          Phill W.
          Here is some code at this link that does what you want:



          Chris

          Comment

          Working...