VB.Net - System.IO.File.Move with Elevated Privileges

Good Day Experts!

I have developed a small SA VB.net exe to move files on one of our network paths.  My searches on the net have been inconclusive.  

It works fine when I execute it from my machine as I have Administrator privileges.  However, when I put it on the User machine it does not work due to lack of permissions.

How can I elevate the privileges of the User in the code to be able to execute System.IO.File.Move?

Thanks,
jimbo99999
Jimbo99999Asked:
Who is Participating?
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.

Éric MoreauSenior .Net ConsultantCommented:
0
David Johnson, CD, MVPOwnerCommented:
the user doesn't have permission from the source or the destination directory?
0
Jimbo99999Author Commented:
Good Day Everyone

Yes, you are correct...unfortunately due to new rule standards the User does not have permission on the source or destination directory.  So, I have been given the task to figure out how to give the User the permissions in my little VB.Net application.  

Eric, thank you for the link reference...I will take a look here today.

Thanks,
jimbo99999
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

David Johnson, CD, MVPOwnerCommented:
Isn't this breaking company policy if the user doesn't have access then they should not have programmatic access as well?   Only a user with the proper access should be able to move the file.
0
Jimbo99999Author Commented:
Eric:

I tried the impersonation link information here this morning.  Unfortunately I am having a bit of trouble.  
My little app is a a windows Form that I load a listview with file to move in a directory. After the User selects the files to move they have to hit a button to execute the move.   The trouble I am having is embedding the Impersonation code into the code behind the button.  

Is there by chance any references the use Impersonation in a Windows form type application?

Thanks,
jimbo99999
0
Éric MoreauSenior .Net ConsultantCommented:
I found yet another example using a Windows Forms application: http://support.microsoft.com/kb/841699/en-us
0
Jimbo99999Author Commented:
Thank you kindly Eric...I appreciate the reference.  I will try this out today.

Thanks,
jimbo99999
0
Éric MoreauSenior .Net ConsultantCommented:
I just tried the example from http://social.msdn.microsoft.com/Forums/en-US/fe8af53c-4912-49c3-9992-5bbeea32b29d/impersonation-to-copy-file?forum=vblanguage and it is working.

It will be the subject of my next article to be published in the next few days!
0
Jimbo99999Author Commented:
I am looking at that one too...thanks for the good info I really appreciate it.

jimbo99999
0
Éric MoreauSenior .Net ConsultantCommented:
0

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
Jimbo99999Author Commented:
Excellent! Just sitting down to give it a try.

Thanks,
jimbo99999
0
Jimbo99999Author Commented:
I am officially impersonating.  Thanks for the help...excellent article!

Thanks,
jimbo99999
0
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
Visual Basic.NET

From novice to tech pro — start learning today.