Group plicy works intermittently!!

canaancanaan Member Posts: 46 ■■□□□□□□□□
I have a group policy object called "Map users".
In this policy I have logon script policy(User configuration >Windows setting >scripts>logon)

This script basically maps users to different folder on the server.
The problem is that the script, for some mysterious, reason doesn't work all the time. Even though it's in the same OU as the users and the client computers and is linked to it.
I’m not sure if it’s the user or the client computer that’s determining whether the script works. It’s very intermittent

This is a copy the script:
(' Map the G to apps
Set objNetwork = Wscript.CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "G:", "\\servername\ClientApps"

'Map H to user's home drive
set wshnet = CreateObject("WScript.Network")
username = wshnet.userName
wshnet.MapNetworkDrive "H:", "\\servername\Users\" & username

I would really appreciate any help.


  • jmc724jmc724 Member Posts: 415
    Why dont you recreate the same logon script and use the net use command to map the drives and test to see if it works then troubleshoot your vbscript.

    To troubleshoot mapdrives to usernames:

    Option Explicit
    Dim objNetwork
    Dim strDriveLetter, strRemotePath, strUserName
    strDriveLetter = "H:"
    strRemotePath = "\\alan\home"

    ' Purpose of script to create a network object. (objNetwork)
    ' Then to apply the MapNetworkDrive method. Result H: drive
    Set objNetwork = WScript.CreateObject("WScript.Network")
    ' Here is where we extract the UserName
    strUserName = objNetwork.UserName
    objNetwork.MapNetworkDrive strDriveLetter, strRemotePath _
    & "\" & strUserName

    ' Extra code just to add a message box
    WScript.Echo " Launch Explorer, check: "& strDriveLetter

    ' End of script.


    To troubleshoot map drives:

    Set objNetwork = WScript.CreateObject("WScript.Network")
    objNetwork.MapNetworkDrive "H:" , "\\alan\home"


    Hope this helps.
    What next?
  • garv221garv221 Member Posts: 1,914
    Very good advice. That is what I use, the "net use" & it works 98% of the time.

    "netuse : \\server\username" -- thats it! Works everytime!

    /persistant : NO --- allows switching of mapped drives. I have mine set to YES though. icon_thumright.gif
Sign In or Register to comment.