Solved

Can't programmatically copy files VB.net to Windows 7 -"Destination Folder Access Denied"

Posted on 2012-03-16
2
2,285 Views
Last Modified: 2012-03-26
Experts - Please help!!

Please let me know how to programmatically (VB.NET 3.5 Framework) How to copy a file within a Windows 7 environment.

I have a WinForms app that runs fine in a Windows XP 32 Bit environment.

It updates a winForms application by programmatically coping files to users machines (via UNC) (i.e. "\\MachineName\C$\Program Files\AppName\AppName.exe").

I have a VB.NET 3.5 Framework in VS2008 and am using "System.IO.File.Copy"

As a reminder - The code still works great for a 32Bit Windows XP machine.

When I run the same code and try to copy to the appropriate folder: \\MachineName\C$\Program Files (x86)\AppName\AppName.exe. It will not copy and gives me the following error:

"Access to the path '"\\MachineName\C$\Program Files\AppName\AppName.exe' is denied."

Please let me know how to copy this. FYI- If I manually copy the files it asks me to confirm that I want to copy the files, and warns me in a popup window
Copy Warning on Windows 7
When I hit "Try Again" it will copy the file.

(On the XP machines it will just copy the file without a warning).

This problem also happens in the regular 64 Bit program file on my (C:\Program Files\AppNameCompilesAs64Bit\AppName.exe).

Again - Please let me know how to programmatically (VB.NET 3.5 Framework) How to copy a file within a Windows 7 environment.
0
Comment
Question by:dantheanswerman
2 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 37730279
0
 
LVL 2

Author Closing Comment

by:dantheanswerman
ID: 37765969
Perfect answer ... I was able to elevate permissions and as long as I run as an administrator, it works perfectly!

Thanks - you made my day.

Dan
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now