Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 722553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:00:14+00:00 2026-05-14T06:00:14+00:00

I have a utility that I have written in VB.net that runs as a

  • 0

I have a utility that I have written in VB.net that runs as a scheduled tasks. It internally calls another executable and it has to access a mapped drive. Apparently windows has issues with scheduled tasks accessing mapped drives when the user is not logged on, even when the authentication credentials are supplied to the task itself. Ok, fine.

To get around this I just passed my application the UNC path.

process.StartInfo.FileName = 'name of executable'
process.StartInfo.WorkingDirectory = '\\unc path\'
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
process.StartInfo.Arguments = 'arguments to executable'
process.Start()

This is the same implementation I used with the mapped drive, however using the UNC path, the process is not behaving as if the UNC path is the working directory.

Are there any known issues setting ProcessStartInfo.WorkingDirectory to an UNC path? If not, what am I doing wrong?

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T06:00:14+00:00Added an answer on May 14, 2026 at 6:00 am

    Your problem with mapped drives when users aren’t logged in is that they don’t exist. Drives are only mapped and available to the currently logged in user. If no one is logged in, no drives are mapped.

    As a workaround you can run through CMD, call PUSHD which will map your UNC to a drive behind the scenes and then execute your code. I’ve copied the tree.com file from my system32 and placed it on my file server as “tree4.com” and this code works as expected (I’m also redirecting standard output so I can see the results of the call but that’s not necessary)

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    
        Using P As New Process()
            'Launch a standard hidden command window
            P.StartInfo.FileName = "cmd.exe"
            P.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
            P.StartInfo.CreateNoWindow = True
    
            'Needed to redirect standard error/output/input
            P.StartInfo.UseShellExecute = False
    
            P.StartInfo.RedirectStandardInput = True
            P.StartInfo.RedirectStandardOutput = True
    
            'Add handler for when data is received
            AddHandler P.OutputDataReceived, AddressOf SDR
    
            'Start the process
            P.Start()
    
            'Begin async data reading
            P.BeginOutputReadLine()
    
            '"Map" our drive
            P.StandardInput.WriteLine("pushd \\file-server\File-Server")
    
            'Call our command, you could pass args here if you wanted
            P.StandardInput.WriteLine("tree2.com  c:\3ea7025b247d0dfb7731a50bf2632f")
    
            'Once our command is done CMD.EXE will still be sitting around so manually exit
            P.StandardInput.WriteLine("exit")
            P.WaitForExit()
        End Using
    
        Me.Close()
    End Sub
    Private Sub SDR(ByVal sender As Object, ByVal e As DataReceivedEventArgs)
        Trace.WriteLine(e.Data)
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a C utility for Linux that checks the contents of /proc/net/dev
I have a small utility app written in Visual Basic 6 that has been
I have a question regarding the creation of a utility that executes another command.
I have a simple single threaded utility written in C# that inserts data into
I have a small utility script written as .Net/C# console app purely for the
I have written a quick Java wrapper that fires off the NMAP executable and
I have a utility that is written in Python and is meant to be
I have written a utility that requires an installation key for uninstallation to ensure
I have written a utility that monitors for Unhandled Exceptions and then creates a
I have written a simple utility that loops through all C# files in my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.