Home All Groups Group Topic Archive Search About
Author
2 Nov 2006 4:18 PM
Alex
Hello all,

I am very new to vb.net and am looking for help to resolve an issue I am
having.

What I am trying to do:  Install IIS by executing sysocmgr.exe

Issue:  I need to wait until the execution of sysocmgr.exe is complete
before moving forward w/ the rest of my code
However, when I try to use the provided "waitforexit()" function, I get an
error, furthermore, ANYTHING i execute after the ".start()", that isnt
writing to a log file, makes the ".start()" fail.  If I remove the
".waitforexit()" the process works correctly.  SYSOCMGR.exe executes w/
passed parameters and IIS gets intstalled.

Error:  Windows Setup - The application could not be initialize


PLEASE HELP. this is driving me nuts.  ~TYAVMIA~

Here is my code:

Dim objProcess As System.Diagnostics.Process
        Dim wait As Integer
        wait = 10000
        Try
            objProcess = New System.Diagnostics.Process
            objProcess.StartInfo.FileName = "sysocmgr.exe"
            objProcess.StartInfo.Arguments = " /i:sysoc.inf
/u:C:\TEMP\IISConfigFile.txt"
            objProcess.Start()

            'Wait until the process passes back an exit code
            objLogFile.WriteLine("I now have to figure out how to make ths
sleep!!!")
            objProcess.WaitForExit(wait)

            'Free resources associated with this process
            objProcess.Close()
        Catch
            objLogFile.WriteLine("Could not start process " & ProcessPath,
"Error")
        End Try

Author
1 Nov 2006 5:23 PM
Miro
Are you sure that "wait 10000" needs to be there?

I pulled this example off the net.
====
   Private Sub btnWaitForExit_Click( _
      ByVal sender As System.Object, _
      ByVal e As System.EventArgs) _
      Handles btnWaitForExit.Click

      ' create a new process
      Dim myProcess As Process = _
         System.Diagnostics.Process.Start("sample.txt")

      ' wait until it exits
      myProcess.WaitForExit()

      ' display results
      MessageBox.Show("Notepad was closed at: " & _
         myProcess.ExitTime & "." & _
         System.Environment.NewLine & "Exit Code: " & _
         myProcess.ExitCode)
      myProcess.Close()
   End Sub


======


Miro



Show quoteHide quote
"Alex" <cam***@yahoo.com> wrote in message
news:ufWU6Gd$GHA.4212@TK2MSFTNGP02.phx.gbl...
> Hello all,
>
> I am very new to vb.net and am looking for help to resolve an issue I am
> having.
>
> What I am trying to do:  Install IIS by executing sysocmgr.exe
>
> Issue:  I need to wait until the execution of sysocmgr.exe is complete
> before moving forward w/ the rest of my code
> However, when I try to use the provided "waitforexit()" function, I get an
> error, furthermore, ANYTHING i execute after the ".start()", that isnt
> writing to a log file, makes the ".start()" fail.  If I remove the
> ".waitforexit()" the process works correctly.  SYSOCMGR.exe executes w/
> passed parameters and IIS gets intstalled.
>
> Error:  Windows Setup - The application could not be initialize
>
>
> PLEASE HELP. this is driving me nuts.  ~TYAVMIA~
>
> Here is my code:
>
> Dim objProcess As System.Diagnostics.Process
>        Dim wait As Integer
>        wait = 10000
>        Try
>            objProcess = New System.Diagnostics.Process
>            objProcess.StartInfo.FileName = "sysocmgr.exe"
>            objProcess.StartInfo.Arguments = " /i:sysoc.inf
> /u:C:\TEMP\IISConfigFile.txt"
>            objProcess.Start()
>
>            'Wait until the process passes back an exit code
>            objLogFile.WriteLine("I now have to figure out how to make ths
> sleep!!!")
>            objProcess.WaitForExit(wait)
>
>            'Free resources associated with this process
>            objProcess.Close()
>        Catch
>            objLogFile.WriteLine("Could not start process " & ProcessPath,
> "Error")
>        End Try
>
>
>
Author
2 Nov 2006 5:49 PM
Alex
Miro,

    Thanks for your response.  Per MSDN documentation, you can either pass
the WaitForExit () function a parameter (int32) "Instructs the Process
component to wait the specified number of milliseconds for the associated
process to exit. " or leave it empty "Instructs the Process component to
wait indefinitely for the associated process to exit. ".  I've tried passing
it a parameter (as you can see in my original code) and leaving it empty,
either way it executes with the same error.

http://msdn2.microsoft.com/en-us/library/system.diagnostics.process.waitforexit.aspx


Show quoteHide quote
"Miro" <miron***@golden.net> wrote in message
news:%23l7Xhod$GHA.4852@TK2MSFTNGP03.phx.gbl...
> Are you sure that "wait 10000" needs to be there?
>
> I pulled this example off the net.
> ====
>   Private Sub btnWaitForExit_Click( _
>      ByVal sender As System.Object, _
>      ByVal e As System.EventArgs) _
>      Handles btnWaitForExit.Click
>
>      ' create a new process
>      Dim myProcess As Process = _
>         System.Diagnostics.Process.Start("sample.txt")
>
>      ' wait until it exits
>      myProcess.WaitForExit()
>
>      ' display results
>      MessageBox.Show("Notepad was closed at: " & _
>         myProcess.ExitTime & "." & _
>         System.Environment.NewLine & "Exit Code: " & _
>         myProcess.ExitCode)
>      myProcess.Close()
>   End Sub
>
>
> ======
>
>
> Miro
>
>
>
> "Alex" <cam***@yahoo.com> wrote in message
> news:ufWU6Gd$GHA.4212@TK2MSFTNGP02.phx.gbl...
>> Hello all,
>>
>> I am very new to vb.net and am looking for help to resolve an issue I am
>> having.
>>
>> What I am trying to do:  Install IIS by executing sysocmgr.exe
>>
>> Issue:  I need to wait until the execution of sysocmgr.exe is complete
>> before moving forward w/ the rest of my code
>> However, when I try to use the provided "waitforexit()" function, I get
>> an
>> error, furthermore, ANYTHING i execute after the ".start()", that isnt
>> writing to a log file, makes the ".start()" fail.  If I remove the
>> ".waitforexit()" the process works correctly.  SYSOCMGR.exe executes w/
>> passed parameters and IIS gets intstalled.
>>
>> Error:  Windows Setup - The application could not be initialize
>>
>>
>> PLEASE HELP. this is driving me nuts.  ~TYAVMIA~
>>
>> Here is my code:
>>
>> Dim objProcess As System.Diagnostics.Process
>>        Dim wait As Integer
>>        wait = 10000
>>        Try
>>            objProcess = New System.Diagnostics.Process
>>            objProcess.StartInfo.FileName = "sysocmgr.exe"
>>            objProcess.StartInfo.Arguments = " /i:sysoc.inf
>> /u:C:\TEMP\IISConfigFile.txt"
>>            objProcess.Start()
>>
>>            'Wait until the process passes back an exit code
>>            objLogFile.WriteLine("I now have to figure out how to make ths
>> sleep!!!")
>>            objProcess.WaitForExit(wait)
>>
>>            'Free resources associated with this process
>>            objProcess.Close()
>>        Catch
>>            objLogFile.WriteLine("Could not start process " & ProcessPath,
>> "Error")
>>        End Try
>>
>>
>>
>
>
Author
1 Nov 2006 6:10 PM
Cor Ligthert [MVP]
Wait for our answers tomorrow, we are not so far in future as you.

Cor

Show quoteHide quote
"Alex" <cam***@yahoo.com> schreef in bericht
news:ufWU6Gd$GHA.4212@TK2MSFTNGP02.phx.gbl...
> Hello all,
>
> I am very new to vb.net and am looking for help to resolve an issue I am
> having.
>
> What I am trying to do:  Install IIS by executing sysocmgr.exe
>
> Issue:  I need to wait until the execution of sysocmgr.exe is complete
> before moving forward w/ the rest of my code
> However, when I try to use the provided "waitforexit()" function, I get an
> error, furthermore, ANYTHING i execute after the ".start()", that isnt
> writing to a log file, makes the ".start()" fail.  If I remove the
> ".waitforexit()" the process works correctly.  SYSOCMGR.exe executes w/
> passed parameters and IIS gets intstalled.
>
> Error:  Windows Setup - The application could not be initialize
>
>
> PLEASE HELP. this is driving me nuts.  ~TYAVMIA~
>
> Here is my code:
>
> Dim objProcess As System.Diagnostics.Process
>        Dim wait As Integer
>        wait = 10000
>        Try
>            objProcess = New System.Diagnostics.Process
>            objProcess.StartInfo.FileName = "sysocmgr.exe"
>            objProcess.StartInfo.Arguments = " /i:sysoc.inf
> /u:C:\TEMP\IISConfigFile.txt"
>            objProcess.Start()
>
>            'Wait until the process passes back an exit code
>            objLogFile.WriteLine("I now have to figure out how to make ths
> sleep!!!")
>            objProcess.WaitForExit(wait)
>
>            'Free resources associated with this process
>            objProcess.Close()
>        Catch
>            objLogFile.WriteLine("Could not start process " & ProcessPath,
> "Error")
>        End Try
>
>
>