nework folder connection problem using vb.net
-
:confused: Hi, Can anyone please clarify me in the following problem? I have created an application in vb.net, which runs some process in background using task scheduler. when I access a network folder like "\\server\somedir" in my GUI it will work, because the loggedon user has permission to that network folder to connect. but I am running the background task as different user who is not having permission to that nework folder. But in windows 2000,XP, when we try to access to that nework folder using network places, it will prompt for username and passwork to connect to network folder. If I know this username and passwork in my background process, how should I connect to network folder in my vb.net programme. After some struggle, I came to know that I need to use CreateProcessWithLogonW API for this. But I am not able to make it work in my VB.net programme and connect to that network folder. And I tried impersonate the user and then create process using System.Diagnostics namespace. but in this case creating process will not take the impersonated user credentials, it only considers default loggedon user credentials. I have tough time in finding this. Please Help me as soon as possible Thanking you Regards PraveenP
-
:confused: Hi, Can anyone please clarify me in the following problem? I have created an application in vb.net, which runs some process in background using task scheduler. when I access a network folder like "\\server\somedir" in my GUI it will work, because the loggedon user has permission to that network folder to connect. but I am running the background task as different user who is not having permission to that nework folder. But in windows 2000,XP, when we try to access to that nework folder using network places, it will prompt for username and passwork to connect to network folder. If I know this username and passwork in my background process, how should I connect to network folder in my vb.net programme. After some struggle, I came to know that I need to use CreateProcessWithLogonW API for this. But I am not able to make it work in my VB.net programme and connect to that network folder. And I tried impersonate the user and then create process using System.Diagnostics namespace. but in this case creating process will not take the impersonated user credentials, it only considers default loggedon user credentials. I have tough time in finding this. Please Help me as soon as possible Thanking you Regards PraveenP
Hi, I sense that You wanted to execute a file on a remote machine. You can create a process in remote machine using WMI. Try reading documentation on System.Management Namespace which speaks on WMI. Creating a process in this way can impersonate the user credentials that you have specified by your background process. Refer http://www.codeproject.com/useritems/wmi.asp for more details Ravi Shankar S Product Designer iSOFT R&D Pvt Ltd Chennai, INDIA Ph: 91-44-4414980 Extn 1103