Mapped Network Drive Issue with UAC On
Keywords: DiskScan network mapped drive drives GetDriveType
Question:
DiskScan(4) is returning a blank string on Windows Vista, even though Windows Explorer shows the network drive mappings.
Answer:
Thank you for notifying us about the problem. We are able to reproduce this.
ISSUE: When running as an Administrator, the user has two contexts: the limited user context, and the administrator context.
When you map drives in Windows Explorer, they are added only for the limited user context. Thus when the script runs in
the administrative context, no mapped drives are 'seen' by the script. WBT files run with user elevation 'HighestAvilable', which
means when running under an Administrator account the script is running in the context of the administrator NOT the user.
OPTIONS:
- Turn off UAC.
- Perhaps map the drives under the administrator context in the first place.
- Try launching the appropriately manifested version of WinBatch Studio: C:\Program Files\WinBatch\System\WBStudio_IT.exe.
WBStudio_IT.exe uses the AsInvoker manifest (this tells WBStudio_IT.exe to run within the user level context ).
- Compile script using the AsInvoker manifest ( tells the script to run within the user level context ).
- You can set this Registry value and you will get access to those drives from both 'integrity' levels.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLinkedConnections =(dword)1
- Administrative users should map network drives under the limited user token. This mapping is
accomplished by scheduling the script to run using the task scheduler. The task scheduler launches the script
under the administrative full token, thereby allowing Windows Explorer, other limited token processes, and
the elevated token process to view the mapped network drives.
References:
See "Group Policy Scripts can fail due to User Account Control" section of this doc:
http://technet2.microsoft.com/WindowsVista/en/library/5ae8da2a-878e-48db-a3c1-4be6ac7cf7631033.mspx?mfr=true
http://serverfault.com/questions/153497/enumerating-and-mapping-network-drives-windows-7-pro-windows-server-2003
- NOTE: Strangely... a single call to AskFileName causes all of these functions to properly locate all of the mapped drives. (You must
then Reboot to reproduce issue).
It would seem that many other functions are also affected by this issue.
Most any function that references the mapped drive: DirChange, DirHome, FileOpen, FileExist, FileItemize, wntGetCon, etc.
Resources:
http://blogs.msdn.com/cjacks/archive/2007/02/19/mapped-network-drives-with-uac-on-windows-vista.aspx
https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=939697&SiteID=1
http://community.installshield.com/showthread.php?p=380031
http://www.vista64.net/forums/vista-installation-setup/29134-when-logged-admin-mapped-drives-arent-visible-only-unc-p.html
Article ID: W17294
File Created: 2011:02:11:15:17:58
Last Updated: 2011:02:11:15:17:58