When I run this code in just standard user mode, I get all my drives including the network drives. When run as administrator, the network drives don't appear in the list. What gives?
List<string> drives = Environment.GetLogicalDrives().ToList();
StringBuilder driveList = new StringBuilder();
foreach (string drive in drives)
driveList.AppendLine(drive);
MessageBox.Show(driveList.ToString());
This is being run under Windows 7. The network drives are from Novell. The code is written in C# using the .NET 4 framework.
This is normal behaviour since Windows Vista network-mapped drives are not available to a process ran with elevated privileges (see Programs may be unable to access some network locations after you turn on User Account Control in Windows Vista or in Windows 7 (KB 937624)). The workaround in the knowledge base article implies registry editing and a computer restart.
See also the blog post Mapped Network Drives with UAC on Windows Vista for more details.