Windows 7 Logon Script Does Not Reconnect Network Drives on Logon

MarkIsrael
MarkIsrael used Ask the Experts™
on
My Logon.vbs script is not mapping drives for Windows 7 clients. It has worked for years and now that we are moving into Windows 7 Enterprise this is a nightmare.

I see an awful lot of people having the same issue, but I don't see any straight up fixes from  Microsoft. I am about ready to pay the ridiculousas fee for MS Tech Support just too find out if there is a fix/Bug/or my favoritete "This is by Design".

The script is pretty simple and it came from the 'Microsoft Scripting Guys'. I use a GPO to point to the script.  Anyone have an idea on how to fix this nasty bugger.

Thanks,
logonscr.vbs
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Top Expert 2014

Commented:
I think you're main problem is this:
'=======================================================
' MappedDrive function
'=======================================================
Function MappedDrive (DriveLetter, SharedPath)

On Error Resume Next
If objNetwork.DriveExists(DriveLetter) Then
   objNetwork.RemoveNetworkDrive DriveLetter, True, True
End If
On Error Resume Next
If objNetwork.DriveExists(SharedPath) Then
   objNetwork.MapNetworkDrive DriveLetter, SharedPath
End If
End Function

Open in new window


which I would change to this:
'=======================================================
' MappedDrive function
'=======================================================
Function MappedDrive (DriveLetter, SharedPath)

On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.DriveExists(DriveLetter) Then
   objNetwork.RemoveNetworkDrive DriveLetter, True, True
End If
On Error Resume Next
If objFSO.FolderExists(SharedPath) Then
   objNetwork.MapNetworkDrive DriveLetter, SharedPath
End If
End Function

Open in new window


The main problem is that the DriveExists and FolderExists methods are part of the Scripting.FileSystemObject object, and not the WScript.Network object.

Regards,

Rob.

Author

Commented:
If this works your a Scriptig Guru that mere words cannot explain. I am giving this a try and see what happens.

Author

Commented:
For reasons unkown the new Map routine did not work. I am not sure if the objFSO is being picked up.
How to Generate Services Revenue the Easiest Way

This Tuesday! Learn key insights about modern cyber protection services & gain practical strategies to skyrocket business:

- What it takes to build a cloud service portfolio
- How to determine which services will help your unique business grow
- Various use-cases and examples

Most Valuable Expert 2012
Top Expert 2014

Commented:
OK, instead of having
On Error Resume Next

can you put
Err.Clear
On Error GoTo 0

and run it manually to see what happens?

Thanks,

Rob.
This is the fix. The problem came up after moving a huge directory from a 2003 R2 SP-2 server to a 2008 R2 SP-2 Enterprise server. This is the easiest way to fix the issue.

Put this in Notepad and save as Win7Fix.reg, then double click and reboot.
It takes a few minutes on the reboot the first time but after that it works
fast and effectively.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
"EnableLinkedConnections"=dword:00000001


Rename the file to .reg and double-click on it. Then you have your fix. I wish I could do this in my script but then I have to have some code where OS=Windows 7 do fix. Since I have servers and  XP still out there.
Win7ShareFix.txt

Author

Commented:
Hey give me my 500 points for finding a fix to this vexing issue.
Most Valuable Expert 2012
Top Expert 2014

Commented:
Hi, thanks for the info.  According to this though:
http://support.microsoft.com/kb/937624

it looks like it would only affect members of the administrators group while UAC is enabled.  Is that the case with you?

Rob.

Author

Commented:
It took a lot of hard work to come up with an easy, simple and fast solution that works everytime.

Author

Commented:
In our envrionment our users have Admin Rights to the local machine. Also, by default the Windows 7 UAC is on. I tried getting rid of the UAC and still it wouldn't work. I knew there wasn't a way for me to remove some 250 users from the local admin so I was stuck. The registry fix works great and has continued to work.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial