Solved

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

Posted on 2012-03-16
2
2,333 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Article by: Lee
Windows 7 Ultimate and Enterprise (and 2008 R2) introduced a new feature you may not be aware of - Boot from VHD.   Boot from VHD (or what Microsoft refers to asNative Boot allows you to install Windows to a VHD (Virtual Hard Disk) file that is t…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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 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…

776 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