Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Why won't my logon scripts map drives under Windows 7?

I'm using a vb script similar to the one below, the script runs using a group policy.

Dim WshNetwork
Set WshNetwork = WScript.CreateObject("WScript.Network")

WshNetwork.MapNetworkDrive "g:", "\\\Saturn\data\"
WshNetwork.MapNetworkDrive "k:", "\\\Saturn\stuff\"

Works fine for Windows XP.

Update: Copying the script locally and running it runs fine so I suspect the Group Policy isn't running the script on Windows 7.

share|improve this question
    
I have exactly the same problem but with Vista and Windows 7 x64, x32 versions are fine across XP, Vista and Windows 7. –  Richard Slater Dec 17 '09 at 16:36

5 Answers 5

Probably not a good idea to use that EnableLinkedConnections registry setting - Microsoft specifically point out in that KB that it's unsupported - it's bound to give you grief later. I've written up a solution here: http://pcloadletter.co.uk/2010/05/15/missing-network-drives/

share|improve this answer
1  
+1 for coherent and comprehensible description of the problem in the linked post –  Martin Sep 20 '10 at 6:38

That exact script you created works fine for me in Windows7, as long as I make the initial backslash into a double. So that you try and map \\saturn\data. (Use backticks to preserve your code formatting)

Does this script generate any errors when you run it by double clicking, instead of as a startup script?

share|improve this answer
    
Hi, I had put two \\ backslashes in when I typed the question but the site on shows one, I've now put three in and it formats correctly. I've updated my post as I now suspect the Group Policy is to blame. –  Steven Dec 18 '09 at 9:45

I suspect the missing slash as well however I would reccomend abandoning the script as long as you have 1 windows 7 /vista/server 2008 machine you now have access to use group policy preferences. You will need to install the preferences client via windos update on all workstations but it makes mapping drives much easier that scripting them. This article is a great summary (better than the one on technet) about how to go about it:

Group Policy Preferences in a Windows 2003 Domain (and a Windows 2008 Domain)

As another aside I've never been fond of mapping drives since windows XP (yes I know sometimes you have to). You should also consider beginnng to educate the users about how to add favorite network locations to the OSes. The libraries feature in windows 7 makes this particularly easy and once set up, I've found that most users prefer it to mapped drives 9after they get over their initial resistance)

share|improve this answer
    
GPPs are awesome! Save so much time and scripting. –  joshperry Jan 21 '11 at 19:19

I strongly suspect that your script is running fine.

I'm betting your users are Administrators, and because you have User Account Control enabled the users' filtered token, under which Explorer runs, doesn't have access to the "drives" that were "mapped" when the logon script ran.

If you're not going to use Group Policy Preferences then you have two choices:

share|improve this answer

With UAC enabled you cannot map drives in a logon script that is assigned using a Group Policy Object (GPO). The GPO logon script does run, but under a different security context, so the mappings get lost.

Microsoft provides a sample script, called launchapp.wsf that works around this problem by running your real logon script a moment later under the correct security context.

It is available here: http://technet.microsoft.com/en-us/library/cc766208(WS.10).aspx

Look for the section titled “Group Policy Scripts can fail due to User Account Control” and also Appendix A, which is the source code for launchapp.wsf.

launchapp.wsf does fix the problem of mapping drives on Vista (and Windows 7) PCs that have UAC enabled. However, it causes another problem: it doesn't work in Windows XP, so XP computers show an error instead of running the logon script.

Fortunately XP computers don't need the launchapp hack, so my company made a modified version of launchapp that tries to do things the Vista way, but if that fails (because you're running XP), it just launches the real logon script straightaway. I can’t share this with you as it’s internal to my company (has real server names etc.) but it wasn’t too hard to do.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.