.net - Mapping a drive and accessing it from another process programmatically (as another user) -


i need launch 2 processes, first map drive (homedrive in case) , second launch application access drive (notepad, example). machine kiosk machine logged in kiosk user has minimal permissions, therefore these processes need run different user (when user accesses machine winforms form takes credentials). way first approached start 2 processes process.start, first running "net" , passing "use h: \homedrive /persistent:no" in order map drive, , second running "notepad" both of these have credentials supplied , useshellexecute set false. problem each process seems separated , drive unable accessed notepad process.

my solution launch both processes 1 process.start call, solution launches "cmd" , passes "/c net use h: \homedrive /persistent:no & notepad". works hoped , homedrive accessible notepad, perfect. except fact command prompt stays open in background, have attempted altering window style hidden or minimized after googling seems if running different user not possible.

has else encountered similar this?

sounds impersonate function work, application running current user use credentials particular 1 task; followed returning current user.

the full info located @ https://msdn.microsoft.com/en-us/library/w070t6ka(v=vs.110).aspx short version

private declare auto function logonuser lib "advapi32.dll" (byval un string, byval domain string, byval pw string, byval logontype integer, byval logonprovider integer, byref token intptr) boolean public declare auto function closehandle lib "kernel32.dll" (byval handle intptr) boolean dim tokenhandle new intptr(0) dim struserid, strpw string 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -