Re: login script to remove mapped drives



You could try using a vbs login script. I have used these before with
great success.

This first one will remove mappings and then set mappings for all users
that get the script:

<<Script Start>>
On Error Resume Next

Set objSysInfo = CreateObject("ADSystemInfo")
Set objNetwork = CreateObject("Wscript.Network")

'removes mapped drive H
objNetwork.RemoveNetworkDrive "H:", True, True

'creats maped drive H
objNetwork.MapNetworkDrive "H:", "\\Server\Share"
<<Script End>

Or this second one will map differently depending on what AD security
groups they are members of

<<Start Script>>
On Error Resume Next

Set objSysInfo = CreateObject("ADSystemInfo")
Set objNetwork = CreateObject("Wscript.Network")

strUserPath = "LDAP://"; & objSysInfo.ComputerName
Set objUser = GetObject(strUserPath)

'Finds users group membership
For Each strGroup in objUser.MemberOf
strGroupPath = "LDAP://"; & strGroup
Set objGroup = GetObject(strGroupPath)
strGroupName = objGroup.CN

'Removes curent mappings
objNetwork.RemoveNetworkDrive "H:", True, True
objNetwork.RemoveNetworkDrive "I:", True, True
objNetwork.RemoveNetworkDrive "R:", True, True
objNetwork.RemoveNetworkDrive "S:", True, True
objNetwork.RemoveNetworkDrive "T:", True, True


'Mappings for all users
objNetwork.MapNetworkDrive "H:", "\\Server\Share"


'Mappings Based on Group Membership
Select Case strGroupName

Case "Group 1"
objNetwork.MapNetworkDrive "I:", "\\Server\Share1"

Case "Group 2"
objNetwork.MapNetworkDrive "R:", "\\Server\Share 2"

Case "Group 3"
objNetwork.MapNetworkDrive "S:", "\\Server\Share 3"

Case "Group 4"
objNetwork.MapNetworkDrive "T:", "\\Server\Share 4"

End Select
Next
<<End Script>>

Hope one of these will help.

.



Relevant Pages

  • Re: VBScript that removes and then maps Network Drives - Richard Mueller - are you there?
    ... specific logon script is awesome. ... mapped or via a .bat/.cmd logon script) when I implement your logon ... script we have a hard time with the "old" mappings going away. ... the object reference objUser instead of objComputer to the IsMember ...
    (microsoft.public.scripting.vbscript)
  • Re: login script failing?
    ... Well if all DCs are in same site/local lan, and only some mappings ... If you manually run that script after user logs on does the mapping occur? ... How do you know whch servers are the users logging on? ... relevant servers but no matter what I put in the login script, ...
    (microsoft.public.windows.server.active_directory)
  • Re: VBScript that removes and then maps Network Drives - Richard Mueller - are you there?
    ... Set objNetwork = CreateObject ... logon script is awesome. ... mapped or via a .bat/.cmd logon script) when I implement your logon ... script we have a hard time with the "old" mappings going away. ...
    (microsoft.public.scripting.vbscript)
  • Re: Loginscript occasionally failing
    ... In the profile area where the loginscript goes we have ... >> appropriate mappings. ... >> reboot multiple times and still not execute the script ... Do you specify logon scripts with Group Policy, ...
    (microsoft.public.windows.server.scripting)
  • Re: GP Functionality???
    ... As well as Richard Mueller's script site ... drives ... checks the user's group membership to assign mappings. ...
    (microsoft.public.windows.server.active_directory)

Loading