VBS Script to Connect to DFS shares
Good afternoon,
I'm trying to change our logon script, it currently uses the MapNetworkDrive method in VBS to connect to our network shares, I'm trying to change it to connect to a DFS share instead of the fileserver directly. However whilst it works connecting to the server
directly, for some reason it won't connect to the DFS shares. Here's the code I'm using:
If IsMember("TeamABC") Then
MapDrive2 "R:", "\\FILESERVER\TeamABC"
End If
Function MapDrive2(Drive2, FileServerShare2)
'Disconnect existing drives
If oFSO.DriveExists(drive2) Then
oNet.RemoveNetworkDrive (drive2)
End if
'Map the drive
If oFSO.DriveExists(FileServerShare2) = True Then
oNet.MapNetworkDrive Drive2, FileServerShare2
Else
Wscript.Echo("Cannot Map " & Drive2 & " to " & FileServerShare2)
End If
End Function
The above works, however changing the function call to this doesn't:
If IsMember("TeamABC") Then
MapDrive2 "R:", "\\DOMAIN\DFSshare\TeamABC"
End If
Can anyone suggest why?
Cheers
CJ
May 15th, 2011 8:23am
Hi,
You may check whether the UAC is enabled on the computer. Because the logon script is running with standard user token, but the explorer is running with full administrator token if you are login with administrator. So you can not see the mapped drive.
Please follow the article below to check this.
http://support.microsoft.com/kb/937624/en-us
Meantime, this forum focuses on Windows 7, but your question is related to how to compose the VBscript. I recommend posting at
http://social.technet.microsoft.com/Forums/en/ITCG/threads/ for further assistance.
Thanks for understanding.Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
May 17th, 2011 1:36pm