|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
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 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 > > > 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 >> >> >> > > 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 > > >
start a windows service remotely
Try Catch Overkill Acccess to a file on desktop is denied Trouble with a console app Try Catch Overkill inserting date into sql server line replacing ideas Looking for online articles/tutorials or good reference books Write an XML node Auto Gen Properties from fields |
|||||||||||||||||||||||