Hello all,
I have been tweaking MarkDmac's great login script (thanks Mark) to adapt to our environment. We are mapping the user and public drives based on group membership. This is because the current network is comprised of one domain, but multiple locations connected via VPN tunnels. Most locations have a DC that hosts the users public and User shares. The users don't travel to other locations, so this works well until we get MPLS sometime in the future. The drive mapping is working well, but I have been asked if we can have the script change the mapped names to something more user friendly.
I have seen the Add On Markdmac created for this task using drive mappings for all, but I'm having trouble deciphering it to apply it to the task of renaming the drives mapped based on group membership. That plus I'm not much of a "from scratch" scripter, so any assistance would be welcome.
Here is the part of the script that is mapping the drives based on group membership. One item to note is that since all the drives mapped are either a user folder or public, it can be simplified for renaming, meaning that all the public drive mappings can be named just public and same for the user drives.
'Now check for group memberships and map appropriate drives
'Note that this checks Global Groups and not domain local groups.
For Each GroupObj In UserObj.Groups
'Force upper case comparison of the group names, otherwise this is case sensitive.
Select Case UCase(GroupObj.Name)
'Check for group memberships and take needed action
'In this example below, ADMIN and WORKERB are groups.
'Note the use of all upper case letters as mentioned above.
'Note also that the groups must be Global Groups.
Case "LOCATION1 USERS"
WSHNetwork.MapNetworkDrive "P:", "\\Long-FQDN-for-location1\Public",True
WSHNetwork.MapNetworkDrive "U:", "\\Long-FQDN-for-location1\Users\"& UserString,True
Case "LOCATION2 USERS"
WSHNetwork.MapNetworkDrive "P:", "\\Long-FQDN-for-location2\Public",True
WSHNetwork.MapNetworkDrive "U:", "\\Long-FQDN-for-location2\Users\"& UserString,True
Case "LOCATION3 USERS"
WSHNetwork.MapNetworkDrive "P:", "\\Long-FQDN-for-location3\Public",True
WSHNetwork.MapNetworkDrive "U:", "\\Long-FQDN-for-location3\Users\"& UserString,True
Case "LOCATION4 USERS"
WSHNetwork.MapNetworkDrive "P:", "\\Long-FQDN-for-location4\Public",True
WSHNetwork.MapNetworkDrive "U:", "\\Long-FQDN-for-location4\Users\"& UserString,True
Case "LOCATION5 USERS"
WSHNetwork.MapNetworkDrive "P:", "\\Long-FQDN-for-location5\Public",True
WSHNetwork.MapNetworkDrive "U:", "\\Long-FQDN-for-location5\Users\"& UserString,True
Case "LOCATION6 USERS"
WSHNetwork.MapNetworkDrive "P:", "\\Long-FQDN-for-location6\Public",True
WSHNetwork.MapNetworkDrive "U:", "\\Long-FQDN-for-location6\Users\"& UserString,True
Case "TEST USERS"
WSHNetwork.MapNetworkDrive "P:", "\\Long-FQDN-for-location1\Public",True
WSHNetwork.MapNetworkDrive "U:", "\\Long-FQDN-for-location1\Users\"& UserString,True
End Select
Next
Rcheek
I have been tweaking MarkDmac's great login script (thanks Mark) to adapt to our environment. We are mapping the user and public drives based on group membership. This is because the current network is comprised of one domain, but multiple locations connected via VPN tunnels. Most locations have a DC that hosts the users public and User shares. The users don't travel to other locations, so this works well until we get MPLS sometime in the future. The drive mapping is working well, but I have been asked if we can have the script change the mapped names to something more user friendly.
I have seen the Add On Markdmac created for this task using drive mappings for all, but I'm having trouble deciphering it to apply it to the task of renaming the drives mapped based on group membership. That plus I'm not much of a "from scratch" scripter, so any assistance would be welcome.
Here is the part of the script that is mapping the drives based on group membership. One item to note is that since all the drives mapped are either a user folder or public, it can be simplified for renaming, meaning that all the public drive mappings can be named just public and same for the user drives.
'Now check for group memberships and map appropriate drives
'Note that this checks Global Groups and not domain local groups.
For Each GroupObj In UserObj.Groups
'Force upper case comparison of the group names, otherwise this is case sensitive.
Select Case UCase(GroupObj.Name)
'Check for group memberships and take needed action
'In this example below, ADMIN and WORKERB are groups.
'Note the use of all upper case letters as mentioned above.
'Note also that the groups must be Global Groups.
Case "LOCATION1 USERS"
WSHNetwork.MapNetworkDrive "P:", "\\Long-FQDN-for-location1\Public",True
WSHNetwork.MapNetworkDrive "U:", "\\Long-FQDN-for-location1\Users\"& UserString,True
Case "LOCATION2 USERS"
WSHNetwork.MapNetworkDrive "P:", "\\Long-FQDN-for-location2\Public",True
WSHNetwork.MapNetworkDrive "U:", "\\Long-FQDN-for-location2\Users\"& UserString,True
Case "LOCATION3 USERS"
WSHNetwork.MapNetworkDrive "P:", "\\Long-FQDN-for-location3\Public",True
WSHNetwork.MapNetworkDrive "U:", "\\Long-FQDN-for-location3\Users\"& UserString,True
Case "LOCATION4 USERS"
WSHNetwork.MapNetworkDrive "P:", "\\Long-FQDN-for-location4\Public",True
WSHNetwork.MapNetworkDrive "U:", "\\Long-FQDN-for-location4\Users\"& UserString,True
Case "LOCATION5 USERS"
WSHNetwork.MapNetworkDrive "P:", "\\Long-FQDN-for-location5\Public",True
WSHNetwork.MapNetworkDrive "U:", "\\Long-FQDN-for-location5\Users\"& UserString,True
Case "LOCATION6 USERS"
WSHNetwork.MapNetworkDrive "P:", "\\Long-FQDN-for-location6\Public",True
WSHNetwork.MapNetworkDrive "U:", "\\Long-FQDN-for-location6\Users\"& UserString,True
Case "TEST USERS"
WSHNetwork.MapNetworkDrive "P:", "\\Long-FQDN-for-location1\Public",True
WSHNetwork.MapNetworkDrive "U:", "\\Long-FQDN-for-location1\Users\"& UserString,True
End Select
Next
Rcheek