unc

WNetAddConnection2 from a Windows Service

雨燕双飞 提交于 2019-11-30 10:54:12
I'm trying to connect to a remote password protected shared folder from a Windows service, which runs as LocalSystem account. It seems that the LocalSystem account is unable to directly access password-protected network shares using WNetAddConnection2() or similar calls. Can anyone confirm this? I've read that impersonating an administrator user might be the way to go. I've tried using LogonUser() and ImpersonateLoggedOnUser() before WNetAddConnection2(), it appears that the mount of the network path succeeds, but then actual accesses (e.g. enumerating of files in remote folder) fail. Any

Give FullTrust to UNC share for Visual Studio 2012 and .Net 4.0

久未见 提交于 2019-11-30 04:51:25
问题 Everytime I try to open a solution that is located on a UNC share I get this dialog: I've tried using the caspol.exe utility that Hanselman talks about here, but it doesn't seem to work. At least not for a .Net 4 project runing in Visual Studio 2012. Running the .NET 4 version of caspol with the same arguments I get this message: WARNING: The .NET Framework does not apply CAS policy by default. Any settings shown or modified by CasPol will only affect applications that opt into using CAS

Strange Visual Studio TFS behavior when working on a Mac file share/unc path

半城伤御伤魂 提交于 2019-11-30 03:26:33
问题 I'm working on a Mac with Yosemite. Yesterday I installed Update 4 of Visual Studio 2013 and noticed a strange behavior when working with TFS 2013 (and TFS as SCM). My source files are mapped to a UNC path on my Mac as a local workspace. When I do changes to my files and try to check-in I get the following message: \\psf\Home\Documents\My\TFS\Customerproject\Source\Calculation\WeightCalculation.cs: Access to the path is denied. When I shelve my changes and unshelve them, I can check-in the

WNetAddConnection2 from a Windows Service

☆樱花仙子☆ 提交于 2019-11-29 15:48:31
问题 I'm trying to connect to a remote password protected shared folder from a Windows service, which runs as LocalSystem account. It seems that the LocalSystem account is unable to directly access password-protected network shares using WNetAddConnection2() or similar calls. Can anyone confirm this? I've read that impersonating an administrator user might be the way to go. I've tried using LogonUser() and ImpersonateLoggedOnUser() before WNetAddConnection2(), it appears that the mount of the

How can I open a UNC path from Linux in Java?

China☆狼群 提交于 2019-11-29 04:36:47
Are there any libraries available that will allow me to read from and write to a Windows Fileshare given a UNC path from Java on Linux. It's trivial on a windows box itself, and I'm aware of smbclient approaches, but I'm looking to do it by dropping in a library. Thanks. Have a look at jcifs . It sounds like what you are looking for. From the jcifs site: JCIFS is an Open Source client library that implements the CIFS/SMB networking protocol in 100% Java. CIFS is the standard file sharing protocol on the Microsoft Windows platform (e.g. Map Network Drive ...). This client is used extensively in

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

馋奶兔 提交于 2019-11-29 01:13:27
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 System.IO.DriveInfo-object if there is a drive letter in the path. Since a path without two backslashes in the first and second positions is, by definiton, not a UNC path, this is a safe way to make this determination. A path with a drive letter in the first position (c:) is a rooted local path. A path without either of this things (myfolder\blah) is a

Cannot access network drive in PowerShell running as administrator

安稳与你 提交于 2019-11-28 16:29:18
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 : Cannot find drive. A drive with the name 'Z' does not exist. At line:1 char:13 + Set-Location <<<< Z: + CategoryInfo : ObjectNotFound: (Z:String) [Set-Location], DriveNotFoundException + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.SetLocationCommand How do I access network drives as administrator? In the end the fix was simply

Mapped Network Drives

只谈情不闲聊 提交于 2019-11-28 14:03:05
I have mapped a network drive to a computer in my home network. Now I am trying to access it via PHP - I did this quick test: echo opendir('Z:\\'); This gives me: Warning: opendir(Z:\) [function.opendir]: failed to open dir: No error in C:\wamp\www\webs\tester-function.php on line 3 What have I done wrong here? I don't want my users typing in the UNC path so is there a way to get the UNC path for them and maybe that will work when I try to access it? This is possible in Microsoft languages but I am not sure how to get PHP to do this - maybe using a cmd.exe command? Please note, the mapped

.Net DriveInfo() with UNC paths?

我怕爱的太早我们不能终老 提交于 2019-11-28 08:49:56
问题 Good morning, is there a way to get a DriveInfo instance for UNC paths (e.g. "\fors343a.ww123.somedomain.net\folder\1\") because for example... var driveInfo = new System.IO.DriveInfo(drive); ... throws an ArgumentException ("Object must be a root directory (\"C:\\") or a drive letter (\"C\").") when using that UNC path above. What would I use in order to retrieve information about that or e.g. how would I check whether a given folder resides on a local drive or an unc path? 回答1: The Remarks

How to (quickly) check if UNC Path is available

断了今生、忘了曾经 提交于 2019-11-27 20:01:31
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 to check if a folder is available? I'm using Windows XP and C#. Pat How's this for a quick and dirty way to check - run the windows net use command and parse the output for the line with the network path of interest (e.g. \\vault2 ) and OK . Here's an example of the output: C:\>net use New connections will be remembered. Status Local Remote Network -