Jump to content

Login script and drive mappings


Recommended Posts

Guest hrd2fnd
Posted

Having no experiance with scripting I thought I would ask for some

help.

 

I have this login script that maps 2 groups to the same drive letter

depending on which group they are in. The problem is the users are in

both groups and none of the drive mappings will map.

 

I'm assuming that it is because of being in both groups that want the

same drive letter. Can anyone give me some advice?

 

Here is a pasting of the script.

 

Thank you in advance

 

Hrd

 

Case "DEPT-xxxx_xxxx"

WSHNetwork.RemoveNetworkDrive "W:"

wscript.sleep 300

WSHNetwork.MapNetworkDrive "W:", "\\server1\xxx\xxx",True

Case "DEPT-yyyy_GRP"

WSHNetwork.RemoveNetworkDrive "W:"

wscript.sleep 300

WSHNetwork.MapNetworkDrive "W:", "\\server1\xxx\yyyy",True

 

 

--

hrd2fnd

------------------------------------------------------------------------

hrd2fnd's Profile: http://forums.techarena.in/members/hrd2fnd.htm

View this thread: http://forums.techarena.in/windows-server-help/1059637.htm

 

http://forums.techarena.in

  • Replies 2
  • Created
  • Last Reply
Guest Richard Mueller [MVP]
Posted

Re: Login script and drive mappings

 

 

"hrd2fnd" <hrd2fnd.3hpgjd@DoNotSpam.com> wrote in message

news:hrd2fnd.3hpgjd@DoNotSpam.com...

>

> Having no experiance with scripting I thought I would ask for some

> help.

>

> I have this login script that maps 2 groups to the same drive letter

> depending on which group they are in. The problem is the users are in

> both groups and none of the drive mappings will map.

>

> I'm assuming that it is because of being in both groups that want the

> same drive letter. Can anyone give me some advice?

>

> Here is a pasting of the script.

>

> Thank you in advance

>

> Hrd

>

> Case "DEPT-xxxx_xxxx"

> WSHNetwork.RemoveNetworkDrive "W:"

> wscript.sleep 300

> WSHNetwork.MapNetworkDrive "W:", "\\server1\xxx\xxx",True

> Case "DEPT-yyyy_GRP"

> WSHNetwork.RemoveNetworkDrive "W:"

> wscript.sleep 300

> WSHNetwork.MapNetworkDrive "W:", "\\server1\xxx\yyyy",True

>

>

 

You have to either use different drive letters, or code so that one group

has preference over the other. However, assuming you have pasted code from a

"Select Case" construction, that is what should happen. Only the first

matching "Case" clause executes. If you run the "Select Case" statement

repeatedly for each group the user is a member, that is a problem. You need

to exit the loop after the first group match is found, perhaps with an "Exit

For" statement.

 

The most likely problem is that the group name does not match exactly with

any of your Case clauses because of case (upper and lower case characters).

I would suggest using the LCase function with the group name, then using

only lower case group names, like "dept-xxxx_xxxx".

 

Otherwise, we may need to see more of your script (especially how you get

group memberships). Also, there is no need for the Sleep statements.

 

--

Richard Mueller

MVP Directory Services

Hilltop Lab - http://www.rlmueller.net

--


×
×
  • Create New...