network-drive

check if network drive exists with timeout in c#

廉价感情. 提交于 2019-12-03 17:31:55
i created a windows service that move files around between the server's hard drive (where the service is installed) to the network drive mapped in the server. one of the problems I encountered while creating a solution was network problems. how do i check if a network drive exists while setting a timeout in checking it? If it times out, I catch the exception and retry in X number of minutes and leave items in queue. thanks! Put the call in a seperate thread and close the thread after a certain timeout. The following link implements a timeout logic for a method: http://kossovsky.net/index.php

How to ensure network drives are connected for an application?

白昼怎懂夜的黑 提交于 2019-12-01 17:39:44
问题 I have a desktop Windows application that is installed in small office environments. The application uses an .MDB database file as its database which is stored on a network drive. Configuration files specify the path of the .MDB file on the server using a letter drive: eg. f:\data\db.mdb The application needs to access this database file when it starts. How can I ensure the network drive is connected and accessible when the application starts? Sometimes Windows doesn't reconnect network

How to create MAP Drive by batch file

二次信任 提交于 2019-12-01 10:59:08
often i have to create map drive where i specify machine and user credential. now i like to know can we write a batch file which will create map drive and where i provide all details like pc and folder location and user credentials etc. i got one as follows but i think this is not one which i require. please guide me. thanks net use \\<network-location>\<some-share>\ password /USER:username @echo Create new L: drive mapping @net use L: \\network path /persistent:yes @echo Create new K: drive mapping @net use K: \\network path /persistent:yes :exit if i do this way...then does it work net use y

Mapping a network drive and checking for its existence in VBScript

旧巷老猫 提交于 2019-12-01 00:46:37
I need to map a network drive into a network path using VBScript. The network path is read directly from input. How should I map the network drive and how to check whether the entered network path already exists? I created a subroutine to map drives... MapDrive "H:","\\server\share" Sub MapDrive(letter, uncpath) on error Resume Next dim drivetype, currentmapping dim objWMIService dim colDisks, objDisk 'Set wshnetwork = CreateObject("Wscript.Network") Set objWMIService = GetObject("winmgmts:" & _ "{impersonationLevel=impersonate}!\\.\root\cimv2") Set colDisks = objWMIService.ExecQuery _ (

Easiest way in C# to find out if an app is running from a network drive?

北城以北 提交于 2019-11-30 06:47:09
I want to programmatically find out if my application is running from a network drive. What is the simplest way of doing that? It should support both UNC paths ( \\127.0.0.1\d$ ) and mapped network drives (Z:). This is for mapped drive case. You can use the DriveInfo class to find out whether drive a is a network drive or not. DriveInfo info = new DriveInfo("Z"); if (info.DriveType == DriveType.Network) { // Running from network } Complete method and Sample Code. public static bool IsRunningFromNetwork(string rootPath) { try { System.IO.DriveInfo info = new DriveInfo(rootPath); if (info

Programmatically determine user who last modified file on Windows?

半世苍凉 提交于 2019-11-30 05:05:20
I've been tasked with writing a simple command line utility in C# that will monitor a directory on a server that several users will be accessing to copy/cut/paste/view data. I used FileSystemWatcher to do this but it's lacking a couple features. Is it possible to determine the user or at least the computer name from where the file is being accessed/modified? (Note: This doesn't have to be with FileSystemWatcher, I'm looking for ANY way to do this.) Joshua I don't think you'll be able to monitor this from C# directly. Not without the help of the host operating system anyway. Windows and NTFS

Grant IIS Express permission to access network drive in VMWare

白昼怎懂夜的黑 提交于 2019-11-29 14:18:07
I have a Windows 7 virtual machine in VMWare that I'm using to develop ASP.NET MVC 5 Web applications with the default IIS Express server. I like to keep my projects saved on an external hard drive which I can access in the virtual machine through a shared folder / network drive. However, when I run my applications, IIS Express cannot access my web.config files in the project directory. It's looking in the right folder so I'm pretty sure this is a permissions issue. How can I grant IIS Express file access to the files on my network drive? Things I've tried Running Visual Studio as an

How can I query a temporary PS-Drive while returning files with a name relative to the drive?

你说的曾经没有我的故事 提交于 2019-11-29 13:15:38
I am trying to create a script where I will be searching the file servers for non inherited permissions. I have run into the 260 character limit for file names as a result. A suggestion I saw, that I thought would help, a couple of times was to create some non persistent PS Drives a couple of levels deep and query those. Problem is when I use Get-ChildItem against the new PS Drives it is returning object with the full network path and not using the name I assigned it. # Cycle the folders Get-ChildItem $rootPath -Directory | select -first 1 | ForEach-Object{ $target = $_ # Create a PS Drive for

Programmatically determine user who last modified file on Windows?

∥☆過路亽.° 提交于 2019-11-29 02:51:00
问题 I've been tasked with writing a simple command line utility in C# that will monitor a directory on a server that several users will be accessing to copy/cut/paste/view data. I used FileSystemWatcher to do this but it's lacking a couple features. Is it possible to determine the user or at least the computer name from where the file is being accessed/modified? (Note: This doesn't have to be with FileSystemWatcher, I'm looking for ANY way to do this.) 回答1: I don't think you'll be able to monitor

How do I access a network drive through the usual System.IO classes?

柔情痞子 提交于 2019-11-28 20:43:02
My software handles multiple operations on files, and I have now finished writing the related functions, using the System.IO classes. I now need to add support for network drives. Using a mapping works very well (although Directory.GetFiles is a bit low, and I don't know why), but I'd now like to be able to deal directly with paths such as \\192.168.0.10\Shared Folder\MyDrive . Is there any way to handle this type of paths other than mounting the drive to an available drive letter, using the newly generated path, and then unmounting? You can use the UNC path (which starts with \\ ) directly in