?
Solved

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

Posted on 2012-03-16
2
Medium Priority
?
2,466 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Assume you have an outside contractor who comes in seasonally or once a week to do some work in your office, but you only want to give him access to the programs and files he needs and keep all other documents and programs private. Can you do this o…
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
Suggested Courses

765 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