Map A Network Drive Over A Windows Service?

Mar 2, 2010

How can I map a network drive over a Windows Service. What I did until now.

Using the Shell command. -> not working.

vb.net

Shell("net use \" & My.Settings.ParaRootPath & " " & My.Settings.ParaPasswordHTTPS & " " & "/user:" & My.Settings.ParaLoginHTTPS)

Using a System.Diagnostics.Process object. -> not working

vb.net

ShellExecute As New System.Diagnostics.Process
ShellExecute.StartInfo.RedirectStandardOutput = True
ShellExecute.StartInfo.FileName = "cmd.exe"

[Code].....

If I run the application as normal application, it is working correctly.

View 2 Replies


ADVERTISEMENT

[VS 2005] Service Control Manager Privileges - Communicate With A Windows Service On A Remote Machine On The Network

Jul 23, 2009

I am trying to communicate with a Windows service on a remote machine on the network but i keep getting an exception saying the following: "System.InvalidOperationException: Cannot open Service Control Manager on computer 'machine001'. This operation might require other priviledges. ---> System.ComponentModel.Win32Exception: Access is denied.

[Code]...

View 4 Replies

VB Windows Service That Maps A Drive Then Uses It?

Feb 22, 2012

How to map a network drive to be used by a service. My question is relatively similar, and I realize there are others that are.. but I can't get it to work. I am creating the service thru visual studio 2010.

I attempted to map using WNetAddConnection2- and it successfully maps and is instantly lost (check if drive is mapped right after mapping it). I tried something else. saw some information about using WSH.. I added the reference and tried using wsh... didn't work.I tried WNetUseConnection and that failed as well.

Attempted running the service under a different profile- that didn't work Once I actually get access to the network drive, i need to copy files from that share into a local directory. Maybe I'm missing the boat here but If someone could give me a thorough explaination of what is actually going on and a direction to head I can probably figure it out

View 1 Replies

VS 2008 Copy File To Network With Windows Service

Dec 9, 2009

I am working on a backup utility for use with the mysql db. Because I need the actual backup to run regardless of if a user is logged on or not, I created the backup engine in a windows service.

Basically the backup engine checks to see if a backup job is scheduled to be run and if it is, it kicks off a mysqldump to do the backup. For sake of performance I am saving all backup jobs to the local c: drive then doing a file copy to the user defined destination.

Everything works fine except for the file copy. If the user selects a local resource to the computer it works fine. However, if a network drive is selected, I get an error that it cannot find the path.

I started thinking about it and believe this is expected since the backup engine is probably oblivious to whatever mapped drives that particular user has, i.e. the mapping process is done when someone logs in and my app is running at a lower level.

I started doing some research on this problem and found that some people are saying that windows services are oblivious of networks all together. This seemed a little odd to me so I thought I would bring the issue here.

Is a windows service truely unaware of network activity? How can I change the program to move the completed backups over to a network drive?

View 5 Replies

Windows Service - When User Connects To The Network Theservice Should Run The Exe File?

Mar 9, 2009

I have to schedule an exe file as windows service.The exe file should be triggered when user connects to the pariticular net work for ex: company network.User can connect/disconnect to the company n/w "n" number of times to the network in a day. so every time when user connects to the network theservice should run the exe file.

View 1 Replies

Determine If A Drive Is Local Or A Network Drive?

Dec 10, 2008

Does anyone know if there is a way to determine if a drive is local or a network drive?

View 1 Replies

.net - WCF Service Hosted In A Managed Windows Service Connect Using A WCF Service Application

Jul 14, 2011

i have a Windows service that is hosting a WCF service through net.tcp and this is working great. I have also created a WCF service application. I am trying to add the net.tcp service reference to the service application. Then I add it to the GAC that goes ok but if I try to RegAsm the WCF service application to allow it to be called from Server.CreateObject I get the error:

Warning: Type library exporter encountered a type that derives from a
generic class and is not marked as
[ClassInterface(ClassInterfaceType.None)]. Class interfaces cannot be
exposed for such types. Consider marking the type with
[ClassInterface(ClassInterfaceType.None)] and exposing an explicit
interface as the default interface to COM using the
ComDefaultInterface attribute.

It does not work. I have tried to call it through a class library but this does not work either as the end point is not set correctly.

View 1 Replies

Compile DLL To Network Drive?

Aug 24, 2009

Compile DLL to network drive

View 1 Replies

Connect To A Map Network Drive?

Aug 30, 2010

I Have a batch file in a server in my network. I maped that shared folder (that batch file exist in it) every time that I want to run that batch file first I should have to connect to that network drive(with username and password) How can I do it in my code . I want to connect to that network drive by code in my form_load. I test codes below but it dose'nt work.

AppDomain.CurrentDomain.SetPrincipalPolicy(Princip alPolicy.WindowsPrincipal)
Dim idnt As New WindowsIdentity(username, password)
Dim context As WindowsImpersonationContext = idnt.Impersonate

View 3 Replies

How To Get UNC Path Of Network Drive

Jul 10, 2009

I am using some like following code to get UNC path of drive letter.
Dim query As New System.Management.ObjectQuery("select * from Win32_LogicalDisk")
Using searcher As New System.Management.ManagementObjectSearcher(Query)
'loops for all drives on system
For Each Mgmt As System.Management.ManagementObject In searcher.Get()

And it was working but now it is giving error. Below is error with stack trace
{"Specified cast is not valid."}
at System.Management.ThreadDispatch.Start()
at System.Management.ManagementScope.Initialize()
at System.Management.ManagementObjectSearcher.Initialize()
at System.Management.ManagementObjectSearcher.Get()

I also want to know alternative way to get unc path of drive that is also not depend on windows API. As there is a class driveinfo to get all drives (including network) on system. Is there any class that also provide complete or unc path information of Drive.

View 6 Replies

Mapping A Network Drive?

Aug 16, 2011

I've followed the instructions found at the letter (albeit also adding the parameters to pass a username and password), but have had no success connecting to a network drive that requires authentication to access.

View 8 Replies

Searching Network Drive?

Sep 2, 2011

I'm working on a program that is used as a tool to quickly search & Open CAD drawings on our network. I have it working for the most part, but it is very slow. Right now I have an ini file with the path to the Directory I want to search for Example "G:" I think the reason this is so slow, is because there are other folders in this directory that don't need to be searched. My idea is to add all of the paths I want the program to search in the ini file, but I don't know how I will have it search through this using vb code

want my ini file to look like this

G:A
G:B
G:C
G:E

So directory D would not be searched by the program because its not in the list.

MyCode
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim PathReader As IO.StreamReader
PathReader = IO.File.OpenText("C:ISOExplorerPath.ini")

[code]....

View 10 Replies

Turn On Network Drive?

Mar 27, 2009

i have a network drive mapped to z each time i turn on the pc that drive is disconnected but i can see the z letter and if i click they return, there is some way to active that letter/drive but vb.net?

View 1 Replies

Windows Service Running Under A Network Account Is Calling An EXE And Running It Under System Account?

Aug 27, 2010

We have a windows service running under a network account that calls and runs an ActiveX exe. The exe is running under the local system account, not the network account of the service.

View 1 Replies

DB/Reporting :: Saving To Network Drive?

Mar 29, 2008

How can I save a file to a folder on a network drive. I have the drive mapped on my pc as "G:" but someone else could have it mapped as "Q:" or something. I can save if I use "G:ServerNameDriveNamefolder"; but can't from another pc unless I change the code to what the drive is mapped to on that pc.

Here is the code I'm trying to use to direct to the folder with out using the mapped drive:

Code:
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
FileOpen(1, "\ServerNameDriveNameFolder" & filenamec.Text, OpenMode.Output) 'location of the file.

View 1 Replies

Deploy .msi File From Network Drive?

Jun 30, 2009

I have developed a visual basic app in Visual studio 2008. I have created a windows installer file. Can I deploy this on a network drive and does .NET framework have to be installed on server? The application has a MS access database associated with it, so I would like to have it backed up via the network.

View 1 Replies

Get / Set A Mapped Network Drive Label

Apr 4, 2009

I am working on a win application that maps/unmaps network drives. And i have a couple of problems getting and setting a mapped network drive's label /name. The driveinfo volumelabel property will get or set the label of the remote drive/folder, what i need is the mapped network drive name/label on the local system. it then adds the driveletter, volumelabel, and connection state to a listview.

[Code]....

View 1 Replies

Get Folder Rights On A Network Drive?

Sep 2, 2010

I want to know what rights the user has for a given folder on a network drive. But I can't find anything that does just this.

I have used DirectoryInfo.GetAccessControl and DirectorySecurity.GetAccessRules, etc. to get a collection (AuthorizationRuleCollection) of rules. But that gives me all the access groups and their rights. I don't need that (I guess I can see if I can find code that gets which returns the security groups for the current user and then compare those to the collection, but this seems awkward.)

Or I can write code that tries to create a file, delete it, etc. which is easy to do, but not quite accurate (if the user can't create a file, how can I see if the user can delete one, if the user has create, but not delete rights, I get a bunch of temp files, etc.)

All I need to know is if the current user has read write, read only, create, and/or delete rights to a given folder (and I guess file might also be nice - I would assume similar code.)

I have to believe that its a really simple thing. But Googling it and searching on the forums here didn't turn up much (unless I want code to change the users rights - which I don't.)

View 1 Replies

Getting Address Of A Mapped Network Drive

Mar 28, 2010

my first question on this board. I'm creating a media player(Like so many others). I try playing files over my network. When I pass this address "M:songssome artistsome song.mp3" to the windows media player control it actually opens "\ServerMEDIAsome artistsome song.mp3". But when my program checks if it is playing the correct song it thinks it is not, because the strings aren't equal. Is there a way in VB to get the network address of a mapped network drive? I can already see that it is a network drive but not wich address it points to.

View 2 Replies

How To Create A Folder In Network Drive

Sep 26, 2011

To create a dynamic folder in local drive it was generating, if suppose we need to create a folder in network path means error say that cannot access to the path is denied, how to resolve this issue , i m working on vb.net

View 1 Replies

Make Network Drive Ready

Mar 8, 2010

i have a NAS drive that is mapped to my system..My application will copy files to the drive but the only problem is the drive has a sleep function on it therefore when i try to copy files to it and it is in sleep mode, it says the folder does not exist (drive still in my computer but just with a red X on it)is there a function to make ir ready ? the only other way to do it is to double click the drive icon in my computer then it wakes up... but id rather not do this as its a pain.

View 3 Replies

Mapping Network Drive Remotely?

Feb 19, 2009

I'm developing an application that needs to Map a network drive for a domain user logged into a domain PC from a remote location. I have tried numerous different things with different levels of success but none with the required functionality. - First, I used WMI to create a process that would run Net Use with no luck: Net Use would ask for a user name and password to connect to the share instead of using the User's credentials.- Second I generated a script (wshNetwork) that would be copied to the remote PC and used WMI to once again create a process that would run wscript in command prompt to execute the copied script.

The script would run successfully (as evident by code placed to fill in a text file when the script completed) but the network drive was not added.- Third I created a program that would be copied to the user's PC which would map the drive using Windows Network API. Again, I used WMI to execute the program as a proccess with the results the same as the script. The application would run successfully but the drive was not added.- Fourth, I edited the user's registry to add the drive. This worked, however the mapped drive was not usable through Windows Explorer without a reboot.

Unfortunately, one of the requirements of the application is to avoid rebooting the remote PC.I have arguably had the greatest success with the following:- I used WMI to generate a scheduled task on the remote PC that would run a script (wshNetwork), an application (Win API) or the Net Use command to map the drive. All resulted in the drive being properly mapped and visable through windows explorer with the files accessable. However, the new map would be labeled "Disconnected Network Drive" and the drive could not be removed (error: network connection could not be found) and the driver letter could not be used without rebooting the system. Anyone have any suggestions on how I can do this? Unfortunately I can't use wshController to run a remote script because a majority of the PCs on the domain are not configured to use it.

View 10 Replies

Save Project To A Network Drive?

Nov 20, 2009

I want my high school students to be able to save their VB projects to their network drive folder on the school's fileserver. The students do not have access to the c: drive by Group Policy. VB does not even see the network drive each student has mapped. I have googled around and discovered it has to do with VB not trusting any network folders. There is a supposed solution by using the .net framework configuration tool but I had no success getting that to work. Right now I have them saving their project to their usb drives. They have a tendency to lose or forget those. Is there a simple way of getting those network folders accessable?

View 2 Replies

Saving Projects To A Network Drive?

Nov 23, 2009

I teach using VB. At the moment the kids are having to save their projects to usb drives because VB does not see the network folders on the fileserver. They lose the usb drives. The kids do not have access to the c: drive by Group Policy. How can I set up VB.net to see the their network drive folder?

View 2 Replies

Using Vs2005 And Put The Exe And Dlls On A Network Drive?

Sep 16, 2009

I have compiled my application using vs2005 and put the exe and dlls on a network drive. The users running windows 7 that don't have write access to the folder cannot run the program. The users on XP can run the program even without write access to the folder. The admins with write access to the folder can run it on both XP and windows 7. Does anyone know what I need to do to fix it other than giving the user write access to the folder.

View 1 Replies

Change The Path For A Network Drive Already Mapped?

Sep 16, 2009

We are getting a new server and we already have a Z: drive mapped, and we want to use the same letter and just change the path without touching all machines. I am looking for a simple VBscript to do that. I have one that will remove and one that will add, but I need to have on script.

View 1 Replies

Check If A Network Drive Is Mapped Persistently?

Oct 18, 2009

I use the following code to layout network drives on a system. I want to add a third column for persistence but in vb.net I do not know how to check if a drive has a persistent map or not.

For Each drive_info As DriveInfo In DriveInfo.GetDrives()
If drive_info.DriveType().ToString = "Network" Then
With maps.Items.Add(drive_info.Name)

[code]......

View 2 Replies

How To Map Network Drive That Requires Username And Password

Jul 7, 2010

I need to map a network drive from within a .NET application. I'm going to need to use an AD Username and Password to authenticate. Usually I just use a batch file with the net use command. How do I do this from within C# or VB.NET code?

View 4 Replies

Mapping A Network Drive Using Username And Password

Jan 18, 2009

I'd like to write a VB script that maps a network drive, but I don't really know where to start. I'd like to script to ask for a username and password, then map the drive.should I write it VB or as a CMD batch file? NET USE Z: \serverfolder\%user% /USER:%USER%@domain /password:%pass%am not even sure I've got that syntax write.

View 5 Replies

Visual Basic 10 - Mapping Network Drive

Oct 14, 2010

Currently I am trying to create a small application which will be used to map a common network drive on an offline computer. Currently my form has: Location Username Password Domain I have these all setup so that when I click to map the drive it will automatically grab the entered information and map it to the W drive. I tried the code below but it isn't working, stating a W32 exception.

[Code]...

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved