Results 1 to 11 of 11

Thread: [RESOLVED] Can't get Process.Start to work on IIS7/Server 2008 (oops it's SBS 2011!)

  1. #1

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Resolved [RESOLVED] Can't get Process.Start to work on IIS7/Server 2008 (oops it's SBS 2011!)

    [edit]actually it's SBS 2011[/edit]

    I cannot get PROCESS.START to work on a Server 2008 box - tried all kinds of credential settings - getting no where.

    I recently added the un/pw stuff - if I put a bad username it gives me an error - but with a good one nothing happens - the process never starts.

    Code:
                    Dim strFile As String = "Report_" & rptid & ".bat"
                    Dim strBatFile As String = Path.Combine(strReportFolder, strFile)
    
                    Using fileWrtr = New StreamWriter(strBatFile, False)
                        fileWrtr.WriteLine("CD /D " & strReportFolder)
                        fileWrtr.WriteLine("set path=" & strReportFolder)
                        'fileWrtr.WriteLine("amc rpt/printers")
                        fileWrtr.WriteLine(strCmd)
                        fileWrtr.Close()
                    End Using
                    Dim psusername As String = "xxxxx"
                    Dim pspassword As SecureString = ConvertToSecureString("passwordxxxx")
                    Dim psdomain As String = "somedomain"
    
                    If blnSubmit Then
                        Try
                            Process.Start(strBatFile, psusername, pspassword, psdomain)
                            .StartObject()
                            .NewObject("rptid", rptid)
                            .Seperate()
                            .NewObject("queued", IIf(blnSubmit, "N", "Y").ToString)
                            .EndObject()
                        Catch ex As Win32Exception
                            .StartObject()
                            .NewObject("%%dalerror%%", ex.Message)
                            .EndObject()
                        Catch ex As Exception
                            .StartObject()
                            .NewObject("%%dalerror%%", ex.Message)
                            .EndObject()
                        End Try
                    End If
    Last edited by szlamany; Apr 1st, 2012 at 06:49 PM.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  2. #2
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    Re: Can't get Process.Start to work on IIS7/Server 2008

    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  3. #3

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Can't get Process.Start to work on IIS7/Server 2008

    I don't have access to the server to make changes like that myself...

    I'm currently trying to debug this - detect any errors - on the started process.

    Code now looks like this

    Code:
                            Dim prc As New ProcessStartInfo
                            prc.WorkingDirectory = strReportFolder
                            prc.FileName = strBatFile
                            prc.UserName = psusername
                            prc.Password = pspassword
                            prc.Domain = psdomain
                            prc.UseShellExecute = False
                            prc.RedirectStandardError = True
                            Dim runningproc As Process = Process.Start(prc) ' strBatFile, psusername, pspassword, psdomain)
                            Dim sr As StreamReader = runningproc.StandardError
                            Dim xyz As String = sr.ReadToEnd
                            .StartObject()
                            .NewObject("%%dalerror%%", xyz)
                            .EndObject()
    When I was missing this line of code

    prc.RedirectStandardError = True

    it gave me an error telling me that error output had not been re-directed - making me think it is starting.

    How can I debug more of this process that I've started???

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  4. #4

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Can't get Process.Start to work on IIS7/Server 2008

    Ok - so now I got it doing this...

    Process.Start is "starting" amcReport.exe - as you can see in the TASKMGR screen shot below.

    And you can also see that amcReport.log has been created - it's showing in that folder.

    This is the code that does that (this is an old VB6 program being "started" to run a report")

    Code:
    If gCommandLine = True Then
              Open "amcReport.log" For Append as #1
              Print #1, "-----------------------------------------"
              Call ReadIni
              Call CommandLine(s1)
              Call TerminateConnection
              Print #1, "Closing"
              Close #1
    But awcReport.exe never gets any CPU time - it never runs...

    I think it might be having a UAC problem - but I can't imagine how it got as far as "creating" that amcReport.LOG file!

    If I use TASKMGR to kill amcReport.exe the .LOG file doesn't even show the line of "------------" - what's up with that?? File I/O doesn't complete properly when you TASKMGR to kill a process...
    Attached Images Attached Images  

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  5. #5
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    Re: Can't get Process.Start to work on IIS7/Server 2008

    This look suspiciously UAC . Can you access the server?
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  6. #6

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Can't get Process.Start to work on IIS7/Server 2008

    Yes - I can access the server.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  7. #7
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    Re: Can't get Process.Start to work on IIS7/Server 2008

    I guess i meant if you have access to make the changes of the article because you said you didn't have access before.
    Also maybe this will give some help?
    http://www.vbforums.com/showthread.php?t=622626
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  8. #8

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Can't get Process.Start to work on IIS7/Server 2008

    It's a brand new Windows SBS 2011 box that my customer just got installed - I'm working with it over RDP and not really comfortable messing with security settings and such.

    I'm considering at the moment creating my own Windows Service to do the PROCESS.START so I have ultimate control over the un/pw credentials that the service runs under.

    Hope I don't do all that to find out the UAC burns me in that situation as well!

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  9. #9
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    Re: Can't get Process.Start to work on IIS7/Server 2008

    Well don't overload the service or something.Just create a simple one for testing.
    Another thought that might or might not work is using impersonation.But i have never tried it in something newer that WS2003 and i don't know if it will even impact with the UAC.
    Also do you need the process or you will code something new using the service?That looks like a better solution if you can do it.
    Last edited by sapator; Apr 1st, 2012 at 05:17 PM.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  10. #10

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Can't get Process.Start to work on IIS7/Server 2008 (oops it's SBS 2011!)

    I went with the web services option - covered in this thread here.

    Definitely the way to go - avoid all the credential issues with ASP.Net.

    See this thread for details

    http://www.vbforums.com/showthread.php?t=676274

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  11. #11
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    Re: [RESOLVED] Can't get Process.Start to work on IIS7/Server 2008 (oops it's SBS 201

    Glad you sorted it out.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width