Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I had a working script for Windows XP clients, distributed via group policy from Windows Server 2003 PDC.

This is the main part of the script:

Function ggMapNetworkDrive(fDriveLetter, fShareName, fDrives, fWSHNet)    
'Map a network drive

Dim lExist
lExist = -1

For i = 0 to fDrives.Count - 1 Step 2
    If fDrives.Item(i) = fDriveLetter Then
        lExist = i
    End If

If lExist = -1 Then
    'no drive, map us a drive
    fWSHNet.MapNetworkDrive fDriveLetter, fShareName
    If fDrives.Item(lExist+1) = fShareName Then
        'do nothing, mapped to right point
        'is mapped somewhere else; remove then map then add again
        fWSHNet.RemoveNetworkDrive fDriveLetter, False, True
        fWSHNet.MapNetworkDrive fDriveLetter, fShareName        
    End If
End If

End Function

How to do the above in Windows 7?

EDIT: Error message...

Script: \\full-path-to-script\logon.vbs
Line: (line containing 'fWSHNet.MapNetworkDrive fDriveLetter, fShareName')
Char: 2
Error: The network path was not found

Code: 80070035
Source: WSHNetwork.MapNetworkDrive

After further inspection I can see something is wrong with networking, here are the symptoms: pinging and address resolution works, access to all computers on the same segment works as expected, but only access to PDC (windows 2003) is not working as expected (as experienced from win XP clients).


I made a change for MapNetworkDrive to map to FQDN and it allowed the script to run. Still access to \server without the domain is not restored yet.

share|improve this question
What error message(s) do you get? Mapping of network drives via VBS login script detinately does work, because this is how I do it. – Ben Pilbrow Jun 22 '10 at 8:36
Updated with error details and other findings... Thanks for confirming that it should work in principle – Unreason Jun 22 '10 at 9:52
Is this 1 machine, a handful or all? I guess it's possible the network hasn't initialised itself yet. Try setting Computer Configuration\Administrative Templates\System\Logon\Always wait for the network at computer startup and logon to Enabled, do a gpupdate and reboot. – Ben Pilbrow Jun 22 '10 at 10:42
Thanks for the input I will follow up, but I think something went wrong during joining the domain and I think I will need to rejoin. – Unreason Jun 22 '10 at 11:01

1 Answer 1

I would recommend looking at Group Policy Preferences for mapped network drives in Windows 7. To support Group Policy Preferences on Windows XP and Windows Vista you will need to install the Group Policy Preferences Client-Side Extensions on the clients - you can do this through WSUS if you have that.

The feature was added for Windows Server 2008 but you don't need a WS08 domain or DC to use it, just the Remote Server Administration Tools pack for Windows 7 or Windows Vista SP1. The Group Policy Management console's Policy Object Editor in RSAT then supports Preferences as well as Policies.

share|improve this answer

Your Answer


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.