From: Rex the Strange on
Hi everyone,

Surely this isn't that hard:

I'm trying to create a routine which is recursive across the entire
directory structure on a designated drive (from the root directory
through every folder on the drive - system, hidden, the lot).

And I'm getting, when I try:

directoryinfo.getdirectories

on a system folder, the dreaded "unauthorized access exception." I
have set the UAC settings to "requireAdministrator" as one post
suggested. I am running as an administrator (I'm the only user of this
computer). Some posts suggest "impersonation" - but I haven't found an
easy explanation of what this is all about.

Who do I have to kill to get past this? Please help?

tia,
rts
From: Mike Lovell on
> Surely this isn't that hard:
>
> I'm trying to create a routine which is recursive across the entire
> directory structure on a designated drive (from the root directory
> through every folder on the drive - system, hidden, the lot).
>
> And I'm getting, when I try:
>
> directoryinfo.getdirectories
>
> on a system folder, the dreaded "unauthorized access exception." I
> have set the UAC settings to "requireAdministrator" as one post
> suggested. I am running as an administrator (I'm the only user of this
> computer). Some posts suggest "impersonation" - but I haven't found an
> easy explanation of what this is all about.
>
> Who do I have to kill to get past this? Please help?

You shouldn't need to go down impersonation or UAC routes if you're running
as administrator.

What "system" folder are you talking about here?

Also Could you post the code/function?

--
Mike
GoTinker, C# Blog
http://www.gotinker.com

From: Peter Duniho on
Rex the Strange wrote:
> Hi everyone,
>
> Surely this isn't that hard:
>
> I'm trying to create a routine which is recursive across the entire
> directory structure on a designated drive (from the root directory
> through every folder on the drive - system, hidden, the lot).
>
> And I'm getting, when I try:
>
> directoryinfo.getdirectories
>
> on a system folder, the dreaded "unauthorized access exception." I
> have set the UAC settings to "requireAdministrator" as one post
> suggested. I am running as an administrator (I'm the only user of this
> computer). Some posts suggest "impersonation" - but I haven't found an
> easy explanation of what this is all about.
>
> Who do I have to kill to get past this? Please help?

If you don't have the rights to view the directory, you don't have the
rights. This really has nothing to do with .NET, but the bottom line
is: if you want to be able to view every single directory on the disk,
you have to be executing the code with the privileges of a user that has
security access to every single directory on the disk.

Simply running with admin rights may well not be enough, depending on
how the permissions on the disk are configured.

Pete
From: Göran Andersson on
Rex the Strange wrote:
> Hi everyone,
>
> Surely this isn't that hard:
>
> I'm trying to create a routine which is recursive across the entire
> directory structure on a designated drive (from the root directory
> through every folder on the drive - system, hidden, the lot).
>
> And I'm getting, when I try:
>
> directoryinfo.getdirectories
>
> on a system folder, the dreaded "unauthorized access exception." I
> have set the UAC settings to "requireAdministrator" as one post
> suggested. I am running as an administrator (I'm the only user of this
> computer). Some posts suggest "impersonation" - but I haven't found an
> easy explanation of what this is all about.
>
> Who do I have to kill to get past this? Please help?
>
> tia,
> rts

Your code is probably trying to do something like looking inside the
trashcan folder.

Check the attributes of each folder. If it's a hidden system folder,
just skip it.

--
G�ran Andersson
_____
http://www.guffa.com
From: Jeff Johnson on
"G�ran Andersson" <guffa(a)guffa.com> wrote in message
news:O1kemfBxKHA.1692(a)TK2MSFTNGP04.phx.gbl...

> Your code is probably trying to do something like looking inside the
> trashcan folder.

Actually, my money's on System Volume Information. Locked down tight as a
drum.