Questions tagged [unc]

A UNC path unambiguously specifies the location of a volume, directory, file or other local or remote resource on Windows.

On Windows, a UNC path specifies the location of a local or remote resource, including files, directories, volumes and more. UNC path generalize traditional file paths. A UNC path has the form \\Hostname\Folder\Resource. A UNCW path (long UNC) has the form \\?\UNC\Hostname\Folder\Resource.

593 questions
239
votes
13 answers

Map a network drive to be used by a service

Suppose some Windows service uses code that wants mapped network drives and no UNC paths. How can I make the drive mapping available to the service's session when the service is started? Logging in as the service user and creating a persistent…
VoidPointer
  • 17,651
  • 15
  • 54
  • 58
158
votes
9 answers

Accessing a Shared File (UNC) From a Remote, Non-Trusted Domain With Credentials

We've run into an interesting situation that needs solving, and my searches have turned up nill. I therefore appeal to the SO community for help. The issue is this: we have a need to programmatically access a shared file that is not in our domain,…
Randolpho
  • 55,384
  • 17
  • 145
  • 179
143
votes
7 answers

Find UNC path of a network drive?

I need to be able determine the path of the network Q drive at work for a WEBMethods project. The code that I have before is in my configuration file. I placed single character leters inside of the directories just for security reasons. I am not…
Doug Hauf
  • 3,025
  • 8
  • 46
  • 70
108
votes
13 answers

How to run batch file from network share without "UNC path are not supported" message?

I am trying to run a batch file from a network share, but I keep getting the following message: "UNC path are not supported. Defaulting to Windows directory." The batch file is located on \\Server\Soft\WPX5\install.bat. While logged in as…
Stew
  • 1,081
  • 2
  • 8
  • 4
79
votes
7 answers

Cannot access network drive in PowerShell running as administrator

I'm running PowerShell in a Windows 7 x64 virtual machine. I have a shared folder on the host mapped as a network drive (Z:). When I run PS normally I can access that drive just fine, but if I run it "as administrator" it tells me: Set-Location :…
EMP
  • 59,148
  • 53
  • 164
  • 220
66
votes
3 answers

Linking a UNC / Network drive on an html page

Just a basic html link question. I have an intranet setup, and I need to link to some network drives. They are located on drives such as \server_drive\blahblah\doc.docx Using file:// does not work on either IE8 or Firefox. How can I link to these…
Doug
  • 1,316
  • 6
  • 19
  • 36
60
votes
1 answer

Copy-Item copies directory as well as contents to UNC path

I'm trying to take the contents of a folder and copy it to another using PowerShell 1.0. Pretty simple stuff and it all works fine using Copy-Item $from $to -recurse if I am copying from a local folder to a local folder. However, if the $to variable…
RhysC
  • 1,644
  • 1
  • 15
  • 23
45
votes
8 answers

How to (quickly) check if UNC Path is available

How can I check if a UNC Path is available? I have the problem that the check takes about half a minute if the share is not available : var fi = new DirectoryInfo(@"\\hostname\samba-sharename\directory"); if (fi.Exists) //... Is there a faster way…
thumbmunkeys
  • 20,606
  • 8
  • 62
  • 110
37
votes
7 answers

Method to determine if path string is local or remote machine

What's the best way, using C# or other .NET language, to determine if a file path string is on the local machine or a remote server? It's possible to determine if a path string is UNC using the following: new Uri(path).IsUnc That works great for…
David Boike
  • 18,545
  • 7
  • 59
  • 94
36
votes
10 answers

Firefox Links to local or network pages do not work

I have a .asp application where image files (.PDF) are stored in a directory (fed by a copier/scanner). The created file names are stored in a database table. When a query is launched from the web page a link to the file is created. When clicked…
Joe
  • 791
  • 4
  • 9
  • 11
35
votes
24 answers

An attempt to attach an auto-named database for file ....database1.mdf failed

I am getting the following error while debugging my visual studio 2010 website: An attempt to attach an auto-named database for file C:\Users...\Desktop\Dpp2012New\App_Data\dppdatabase.mdf failed. A database with the same name exists, or specified…
rahulserver
  • 10,411
  • 24
  • 90
  • 164
30
votes
5 answers

What is the correct way to check if a path is an UNC path or a local path?

The easiest way to check if a path is an UNC path is of course to check if the first character in the full path is a letter or backslash. Is this a good solution or could there be problems with it? My specific problem is that I want to create an…
David Eliason
  • 301
  • 1
  • 3
  • 7
29
votes
7 answers

Is there a way to map a UNC path to a local folder on Windows 2003?

I know that I can map a UNC path to a local drive letter. However, I am wondering if there is a way to map a UNC path to a local folder. I have a program that has a specific folder hard coded into the program and I am wanting to try and create a…
Davin Studer
  • 1,501
  • 3
  • 15
  • 28
25
votes
3 answers

Running Get-ChildItem on UNC path works in Powershell but not in Powershell run in batch file

I am writing a batch file that executes a Powershell script that at one point loops items with UNC paths as attributes and uses Get-ChildItem on those paths. In a minimal version, this is what is happening in my scripts: Master.bat powershell…
Jon Chan
  • 969
  • 2
  • 12
  • 22
20
votes
6 answers

Workaround for href="file://///..." in Firefox

On an intranet site, let's say I want to link to a file on a share using UNC, at: \\servername\foldername\filename.rtf It seems the correct way to do this is with markup like this:
hmqcnoesy
  • 4,165
  • 3
  • 31
  • 47
1
2 3
39 40