Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Process.Start

Process.Start

Scheduled Pinned Locked Moved Visual Basic
csharpsysadminquestion
21 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Jon_Boy

    You could try shelling to the program, or declaring the process?

    Dim sysPath As String = \\ServerName\Application\test.exe
    Shell(syspath, AppWinStyle.NormalFocus, True)

    Declare process

    Dim udtProcess As Process = New Process
    udtProcess.Start(strProcess)

    Any suggestions, ideas, or 'constructive criticism' are always welcome.

    J Offline
    J Offline
    Jon_Boy
    wrote on last edited by
    #10

    Got zinged on the previous reply..............but don't know why. Give some constructive criticism so that we can all learn - thanks!

    Any suggestions, ideas, or 'constructive criticism' are always welcome.

    1 Reply Last reply
    0
    • K KreativeKai

      > What account is this service running under?? Network logon we use for these type of applications with administrative privileges and access to all the network locations I'm trying to reach. This is also the network login I use to sign onto the server and setup scheduled tasks, etc. > Shell is outdated and not guaranteed to be there in future versions of VB.NET. It's only there for > backwards compatibility with VB6 code. That is what I thought. I don't want to write code that is not guaranteed to work in the next release and forward if I can help it. > You service needs to be running under an account that has permissions to the network resources > you're talking about in order to work properly. I can run the application from the server signed on with the same credentials and it works like a charm. > Is this "D:" drive a local drive to the workstation running the service?? Or is it a mapped drive > to a network share?? If so, is there a login script that maps this drive when the user logs in?? The D: drive is a local second hard drive on the server. If I locate the application on this drive and have the service start it, everything works fine. If I keep it on the other server where it should be, I can start it manually, but the service doesn't want to fire it off. :confused:

      Lost in the vast sea of .NET

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #11

      Was this second .EXE written under .NET (C#, VB.NET)?? If so, then you're running into the Code Access Security problem where code running from a network source is not trusted. You have to tell the .NET CLR on the machine running the code to trust the network location the code is stored on or sign the code and tell it to trust code signed with a ceratin certificate.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008

      K 1 Reply Last reply
      0
      • K KreativeKai

        I agree with catching all exceptions and the service is processing the code. Nothing fires however. I tried mapping the network directory on the server and for some reason when the service runs under the same network credentials as the login that I created the mapping it didn't recognize the path. It bailed and was caught by the try/catch logic. Like I said the credentials for the service firing off the executable is using a network credential with administrative privileges. The shell logic which was the first reply seems to work but I'm not sure why the process.start logic doesn't. Any other suggestions are appreciated.

        Lost in the vast sea of .NET

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #12

        KreativeKai wrote:

        I tried mapping the network directory on the server and for some reason when the service runs under the same network credentials as the login that I created the mapping it didn't recognize the path.

        This is because any mapping you make is specific to your logon session. Any other session using the same credentials will not see any drive you map. That's why I asked if the drive is mapped from a login script. Services run under their own login session and under an entirely different desktop. They (normally) have no idea, nor should they even care, if a user is logged on or not.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007, 2008

        1 Reply Last reply
        0
        • K KreativeKai

          I agree with catching all exceptions and the service is processing the code. Nothing fires however. I tried mapping the network directory on the server and for some reason when the service runs under the same network credentials as the login that I created the mapping it didn't recognize the path. It bailed and was caught by the try/catch logic. Like I said the credentials for the service firing off the executable is using a network credential with administrative privileges. The shell logic which was the first reply seems to work but I'm not sure why the process.start logic doesn't. Any other suggestions are appreciated.

          Lost in the vast sea of .NET

          W Offline
          W Offline
          Wendelius
          wrote on last edited by
          #13

          Instead of directly starting the exe, try to use ProcessInfo class. Especially following properties may be helpful: - Domain - ErrorDialog - FileName - LoadUserProfile - RedirectStandardError/Output - Username/Password - WorkingDirectory Hope this helps, Mika

          The need to optimize rises from a bad design. My articles[^]

          K 1 Reply Last reply
          0
          • D Dave Kreskowiak

            Was this second .EXE written under .NET (C#, VB.NET)?? If so, then you're running into the Code Access Security problem where code running from a network source is not trusted. You have to tell the .NET CLR on the machine running the code to trust the network location the code is stored on or sign the code and tell it to trust code signed with a ceratin certificate.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007, 2008

            K Offline
            K Offline
            KreativeKai
            wrote on last edited by
            #14

            > Was this second .EXE written under .NET (C#, VB.NET)?? Yes > If so, then you're running into the Code Access Security problem where code running from a network > source is not trusted. You have to tell the .NET CLR on the machine running the code to trust the > network location the code is stored on or sign the code and tell it to trust code signed with a > ceratin certificate. I'm going to look into this. I've seen this problem in the past and we even have a MSI file that we created to set security on workstations. I'm going to review our documentation and tweak the server with these settings and see if it helps. Thanks! :)

            Lost in the vast sea of .NET

            D 1 Reply Last reply
            0
            • K KreativeKai

              > Was this second .EXE written under .NET (C#, VB.NET)?? Yes > If so, then you're running into the Code Access Security problem where code running from a network > source is not trusted. You have to tell the .NET CLR on the machine running the code to trust the > network location the code is stored on or sign the code and tell it to trust code signed with a > ceratin certificate. I'm going to look into this. I've seen this problem in the past and we even have a MSI file that we created to set security on workstations. I'm going to review our documentation and tweak the server with these settings and see if it helps. Thanks! :)

              Lost in the vast sea of .NET

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #15

              Just remember, you have to tweak the machine that's going to be running the code, not the server where it's stored.

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007, 2008

              K 2 Replies Last reply
              0
              • D Dave Kreskowiak

                Just remember, you have to tweak the machine that's going to be running the code, not the server where it's stored.

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                     2006, 2007, 2008

                K Offline
                K Offline
                KreativeKai
                wrote on last edited by
                #16

                The code running is on a server and the service calling the code is on another server. Both servers are set to full trust on the code access settings for intranet in the 1.1 configuration tool found in administrative tools. Unfortunately both apps (Service and code we're running are 2005 framework 2.0). Where do we find the configuration tool for 2.0. The framework is loaded, but the tool is not there. Is it a seperate install or is it a different process entirely? Thanks for all your help. I believe this is definitely the issue. I'm heading out for the day, but will check for a reply if you have a chance in the remainder of the day to reply. Thanks again!

                Lost in the vast sea of .NET

                J 1 Reply Last reply
                0
                • K KreativeKai

                  The code running is on a server and the service calling the code is on another server. Both servers are set to full trust on the code access settings for intranet in the 1.1 configuration tool found in administrative tools. Unfortunately both apps (Service and code we're running are 2005 framework 2.0). Where do we find the configuration tool for 2.0. The framework is loaded, but the tool is not there. Is it a seperate install or is it a different process entirely? Thanks for all your help. I believe this is definitely the issue. I'm heading out for the day, but will check for a reply if you have a chance in the remainder of the day to reply. Thanks again!

                  Lost in the vast sea of .NET

                  J Offline
                  J Offline
                  Jon_Boy
                  wrote on last edited by
                  #17

                  Get the Dot Net 2.0 SDK and use mscorcfg.msc in the run window.

                  Any suggestions, ideas, or 'constructive criticism' are always welcome.

                  K 1 Reply Last reply
                  0
                  • J Jon_Boy

                    Get the Dot Net 2.0 SDK and use mscorcfg.msc in the run window.

                    Any suggestions, ideas, or 'constructive criticism' are always welcome.

                    K Offline
                    K Offline
                    KreativeKai
                    wrote on last edited by
                    #18

                    I installed the Framework 2.0 SDK on the server, went to administrative tools, configuration tool for framework 2.0 and moved the Code Access Security for the Intranet Zone to Full Trust. Restarted my service and it worked without a hitch. Thanks for all your help! :)

                    Lost in the vast sea of .NET

                    1 Reply Last reply
                    0
                    • D Dave Kreskowiak

                      Just remember, you have to tweak the machine that's going to be running the code, not the server where it's stored.

                      A guide to posting questions on CodeProject[^]
                      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                           2006, 2007, 2008

                      K Offline
                      K Offline
                      KreativeKai
                      wrote on last edited by
                      #19

                      Thanks for all your help! The code access security change worked! :)

                      Lost in the vast sea of .NET

                      1 Reply Last reply
                      0
                      • W Wendelius

                        Instead of directly starting the exe, try to use ProcessInfo class. Especially following properties may be helpful: - Domain - ErrorDialog - FileName - LoadUserProfile - RedirectStandardError/Output - Username/Password - WorkingDirectory Hope this helps, Mika

                        The need to optimize rises from a bad design. My articles[^]

                        K Offline
                        K Offline
                        KreativeKai
                        wrote on last edited by
                        #20

                        Thanks for your help! The problem turned out to be linked to security. Thanks again! :)

                        Lost in the vast sea of .NET

                        W 1 Reply Last reply
                        0
                        • K KreativeKai

                          Thanks for your help! The problem turned out to be linked to security. Thanks again! :)

                          Lost in the vast sea of .NET

                          W Offline
                          W Offline
                          Wendelius
                          wrote on last edited by
                          #21

                          No problem :)

                          The need to optimize rises from a bad design. My articles[^]

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups