Thursday, October 9, 2008

Admin: Access Denied to Documents and Settings?

Even as an administrator you cannot access the “Local Settings”, “My Documents” and “Application Data” folders because in Vista they are actually located elsewhere. The dim icons with the shortcut links you see are actually referred to as “Junctions”. These junctions are used by Vista for compatibility but really just redirect programs to the proper location in Vista. Now it would be helpful if the Windows File Explorer treated these like shortcuts and took you to the new location, but instead you get the very unintuitive “Not accessible” / “Access Denied” error, leaving you to think changing permissions may be a good idea. Don’t. Leave them alone and let Vista do it’s thing. As a savvy Vista user, you should go to the new “proper” location and identify these locations as legacy remnants of days past.


Here are several junctions from my local system:

Directory of C:\ProgramData

  • Application Data [C:\ProgramData]
  • Desktop [C:\Users\Public\Desktop]
  • Documents [C:\Users\Public\Documents]
  • Favorites [C:\Users\Public\Favorites]
  • Start Menu [C:\ProgramData\Microsoft\Windows\Start Menu]
  • Templates [C:\ProgramData\Microsoft\Windows\Templates]

Directory of C:\Users\Bob Kelly

  • Application Data [C:\Users\Bob Kelly\AppData\Roaming]
  • Cookies [C:\Users\Bob Kelly\AppData\Roaming\Microsoft\Windows\Cookies]
  • Local Settings [C:\Users\Bob Kelly\AppData\Local]
  • My Documents [C:\Users\Bob Kelly\Documents]
  • NetHood [C:\Users\Bob Kelly\AppData\Roaming\Microsoft\Windows\Network Shortcuts]
  • PrintHood [C:\Users\Bob Kelly\AppData\Roaming\Microsoft\Windows\Printer Shortcuts]
  • Recent [C:\Users\Bob Kelly\AppData\Roaming\Microsoft\Windows\Recent]
  • SendTo [C:\Users\Bob Kelly\AppData\Roaming\Microsoft\Windows\SendTo]
  • Start Menu [C:\Users\Bob Kelly\AppData\Roaming\Microsoft\Windows\Start Menu]
  • Templates [C:\Users\Bob Kelly\AppData\Roaming\Microsoft\Windows\Templates]

I’ve found that the best way to access common locations in Vista is to use environment variables. Looking for the All Users Profile? That is a tough one– in Vista that location is now C:\ProgramData. But if you think you’ll have trouble remembering that do what programs [should] do and use the ALLUSERSPROFILE environment variable. 

To see the environment variables on your computer, type SET at the command prompt for a full list. Not all environment variables offer path values, so here is a cleaned up list of common directories my computer spat out:

 

  • ALLUSERSPROFILE=C:\ProgramData
  • APPDATA=C:\Users\Bob\AppData\Roaming
  • CommonProgramFiles=C:\Program Files\Common Files
  • ComSpec=C:\Windows\system32\cmd.exe
  • HOMEDRIVE=C:
  • HOMEPATH=\Users\Bob
  • LOCALAPPDATA=C:\Users\Bob\AppData\Local
  • ProgramData=C:\ProgramData
  • ProgramFiles=C:\Program Files
  • PUBLIC=C:\Users\Public
  • SystemDrive=C:
  • SystemRoot=C:\Windows
  • TEMP=C:\Users\Bob\AppData\Local\Temp
  • TMP=C:\Users\Bob\AppData\Local\Temp
  • USERPROFILE=C:\Users\Bob
  • windir=C:\Windows

Hopefully this saves someone some serious frustration!

1 comments:

Mr Invader said...

Thanks for your article, it _did_ save me hours of frustration :). It reminds me of when I was a beta for NT4 and didn't understand how permissions worked, and hosed my fs with a recursive application of permissions.. If I'd had an article like yours then I'd have saved myself a bunch of grief :). Thank you.

Heres a directory dump of programdata showing the Junctions and where they point to. Agreed, explorer should just treat them as a shortcut, or in unix terms, a symlink, to the target..

Alas the M$ 80/20 rule applies. they go 80% of the way toward the goal and drop the other 20% b/c it didn't appear to aid in selling the product, goal #1 OF 1.

C:\ProgramData]dir /ah
Volume in drive C has no label.
Volume Serial Number is 6CDB-C086

Directory of C:\ProgramData

04/22/2009 04:27 AM [DIR] .
04/22/2009 04:27 AM [DIR] ..
04/22/2009 04:27 AM [JUNCTION] Application Data [C:\ProgramData]
04/22/2009 04:27 AM [JUNCTION] Desktop [C:\Users\Public\Desktop]
04/22/2009 04:27 AM [JUNCTION] Documents [C:\Users\Public\Documents]
04/22/2009 04:27 AM [JUNCTION] Favorites [C:\Users\Public\Favorites]
04/22/2009 04:27 AM [JUNCTION] Start Menu [C:\ProgramData\Microsoft\Windows\Start Menu]
04/22/2009 04:27 AM [JUNCTION] Templates [C:\ProgramData\Microsoft\Windows\Templates]
0 File(s) 0 bytes
8 Dir(s) 14,649,749,504 bytes free

C:\ProgramData]