Authentication of Shared Drive Programatically

My application requires to copy data to \\yourUNC\path which is password protected
My application is aware of the UserName and Password.
If I use

Net Use \\yourUNC\path /username password

then that Share will be accessible from Windows Explorer too until it is deleted which is a security lapse.

I Use Delphi Xe2 with Windows OS
Allan_FernandesAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NVITEnd-user supportCommented:
Can use add into your application, to delete the connection...
Net Use \\yourUNC\path /delete
Allan_FernandesAuthor Commented:
But During Execution of the program  the folder can be misused by other users
NVITEnd-user supportCommented:
can you do without using Net Use?
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

NVITEnd-user supportCommented:
NET USE will be connected as the user that runs your program. If the user is an admin, then it connects as admin. If as the user, then connects as the user.

Who is it run as?
Allan_FernandesAuthor Commented:
Mine is a backup application and will be loaded as a Std User. I would prefer that the code is within my application. For Your Information, I also have a service running in Local System and there is a centrally located UI module wherein I can ask and store all required User names , passwords etc.
purpleoakCommented:
you can use

Dim WshNetwork
Set WshNetwork = WScript.CreateObject("WScript.Network")
WshNetwork.MapNetworkDrive "T:", \\MyServer\MyData
David Johnson, CD, MVPOwnerCommented:
you don't need to "Net use a share you can just reference the unc path
Sinisa VukSoftware architectCommented:
you need something like RunAs.....copy \\dd\ee\*.txt \dest
Look at old EE question...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows OS

From novice to tech pro — start learning today.