471,350 Members | 1,934 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

Deleting a user profile folder

Hi,
In my app I need to delete several user profiles inside the Documents
and Settings folder.
But everytime i try Directory.Delete(path) I get a IOException with
"Access denied to path ..", however I can delete the folders using
windows explorer.

I'm logged in as an admin and the program runs under my account.
I've spent hours googling for a solution, but only found other people
with the same problem.
thanks in advance

Dec 6 '05 #1
2 5370
User the Delete profile API defined in Userenv.dll.
"Iceken" <sa********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Hi,
In my app I need to delete several user profiles inside the Documents
and Settings folder.
But everytime i try Directory.Delete(path) I get a IOException with
"Access denied to path ..", however I can delete the folders using
windows explorer.

I'm logged in as an admin and the program runs under my account.
I've spent hours googling for a solution, but only found other people
with the same problem.
thanks in advance

Dec 6 '05 #2

"Iceken" <sa********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Hi,
In my app I need to delete several user profiles inside the Documents
and Settings folder.
But everytime i try Directory.Delete(path) I get a IOException with
"Access denied to path ..", however I can delete the folders using
windows explorer.

I'm logged in as an admin and the program runs under my account.
I've spent hours googling for a solution, but only found other people
with the same problem.
thanks in advance


Why re-inventing the wheel, use the command line tools built for this.
"net user username /delete "
deletes the user and it's profile.
You can use Process.Start to execute this command from code.

Willy.


Dec 6 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Ed | last post: by
13 posts views Thread by Bob Darlington | last post: by
reply views Thread by Pavils Jurjans | last post: by
6 posts views Thread by Jeff | last post: by
1 post views Thread by Microsoft News Group | last post: by
12 posts views Thread by wheels619 | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.