login script does not map all drives.

Melinda Burns
Melinda Burns used Ask the Experts™
on
We currently have a login script that maps all the drives for our users. one users loses a drive when he reboots his system.  I have checked his permission and security settings and he has full access to the drive in question.   It works for all the other users.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
do they have the login bat in their profile?
Melinda Burnscomputer support

Author

Commented:
yes they do.
Can this be reproduced on another PC ?   Does the user occasionally use a portable usb drive ?
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Juan Jose PerezMIS Coordinator

Commented:
Does this PC has good login to domain?
Do you need to input user name and password to reconnect the maps?
do you have Drive Letters assigned with the same  letter?
Melinda Burnscomputer support

Author

Commented:
When he logs into another computer, the same thing happens. It  will map all the other drives except for one particular drive.  he ends up having to manually map it.
Juan Jose PerezMIS Coordinator

Commented:
does this drive has a letter assigned like E or D? that is interference with USB or DVD
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
Can you open a regular (not admin) command prompt and do the following:

1. NET USE X: /Delete for all drives in the script.
2. NET USE <enter> and what is left?  Anything?
3. Run the script in the Command Prompt.  What error occurs?
Juan Jose PerezMIS Coordinator

Commented:
does this map has a letter assigned like E or D that interference with USB or DVD drives??
Melinda Burnscomputer support

Author

Commented:
No it doesnt. I did check that.
Juan Jose PerezMIS Coordinator

Commented:
can you copy part of your script??

do you use net use Driveletter /delete?
and then net use drive letter
Melinda Burnscomputer support

Author

Commented:
John,,,I deleted all the mapped drives using the NET USE command and then ran the script again. and it still did not map the G: Drive  All the other drives were mapped.,\
Melinda Burnscomputer support

Author

Commented:
Const G_Drive = "cn=cadarch_ro"
Const J_Drive="cn=commercial_ro"
Const M_Drive="cn=drafting_full"
Const X_Drive="cn=mep full"
Const R_Drive="cn=revit_full"

Set objNet = CreateObject("WScript.Network")
Set oShell = CreateObject("Shell.Application")
Set wshell = CreateObject("WScript.Shell")

Set objUser = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & objUser.UserName)
strGroup = LCase(Join(CurrentUser.MemberOf))

On Error Resume Next

wshShell.Run "%COMSPEC% /c net time ", 0, True

set wshell = Nothing

objNet.RemoveNetworkDrive "g:", True, True  
objNet.RemoveNetworkDrive "i:", True, True  
objNet.RemoveNetworkDrive "j:", True, True  
objNet.RemoveNetworkDrive "k:", True, True  
objNet.RemoveNetworkDrive "l:", True, True  
objNet.RemoveNetworkDrive "m:", True, True  
objNet.RemoveNetworkDrive "n:", True, True  
objNet.RemoveNetworkDrive "o:", True, True
objNet.RemoveNetworkDrive "r:", True, True  
objNet.RemoveNetworkDrive "t:", True, True  
objNet.RemoveNetworkDrive "u:", True, True
objNet.RemoveNetworkDrive "w:", True, True
objNet.RemoveNetworkDrive "x:", True, True  
objNet.RemoveNetworkDrive "z:", True, True

objNet.MapNetworkDrive "h:", "\\GE-H1\Home\" & objNet.UserName
Drive = "H:\"
oShell.NameSpace(Drive).Self.Name = "Home"

objNet.MapNetworkDrive "i:", "\\GE-H1\tpl"
Drive = "i:\"
oShell.NameSpace(Drive).Self.Name = "TPL"

objNet.MapNetworkDrive "k:", "\\GE-H1\data"
Drive = "k:\"
oShell.NameSpace(Drive).Self.Name = "Data"

objNet.MapNetworkDrive "l:", "\\GE-H1\complete\" & objnet.UserName
Drive = "l:\"
oShell.NameSpace(Drive).Self.Name = "Complete"

objNet.MapNetworkDrive "n:", "\\GE-H1\name\" & objNet.UserName
Drive = "n:\"
oShell.NameSpace(Drive).Self.Name = "Name"

objNet.MapNetworkDrive "o:", "\\GE-H1\common"
Drive = "o:\"
oShell.NameSpace(Drive).Self.Name = "Common"

objNet.MapNetworkDrive "t:", "\\GE-H1\img_data"
Drive = "t:\"
oShell.NameSpace(Drive).Self.Name = "Img Data"

objNet.MapNetworkDrive "u:", "\\GE-H1\jismn"
Drive = "u:\"
oShell.NameSpace(Drive).Self.Name = "JISMN"

objNet.MapNetworkDrive "z:", "\\GE-H1\archive"
Drive = "z:\"
oShell.NameSpace(Drive).Self.Name = "JIS Archive"

If InStr(strGroup, lcase(R_Drive)) Then
objNet.MapNetworkDrive "r:", "\\GE-H1\revit"
Drive = "r:\"
oShell.NameSpace(Drive).Self.Name = "Revit"
End If

If InStr(strGroup, lcase(G_Drive)) Then
objNet.MapNetworkDrive "g:", "\\GE-H1\cadarch"
Drive = "g:\"
oShell.NameSpace(Drive).Self.Name = "Cadarch"
End If

If InStr(strGroup, lcase(J_Drive)) Then
objNet.MapNetworkDrive "j:", "\\GE-H1\commercial"
Drive = "j:\"
oShell.NameSpace(Drive).Self.Name = "Commercial"
End If

If InStr(strGroup, lcase(M_Drive)) Then
objNet.MapNetworkDrive "m:", "\\GE-H1\drafting\libio"
Drive = "m:\"
oShell.NameSpace(Drive).Self.Name = "Libio"
End If

If InStr(strGroup, lcase(X_Drive)) Then
objNet.MapNetworkDrive "x:", "\\GE-H1\MEP"
Drive = "x:\"
oShell.NameSpace(Drive).Self.Name = "MEP"
End If
Juan Jose PerezMIS Coordinator

Commented:
is the user part of the cadarch_ro?
Melinda Burnscomputer support

Author

Commented:
No he is in the Cadarch_Full
Juan Jose PerezMIS Coordinator

Commented:
change the script for Cadarch_Full  just for this user.... and test
Juan Jose PerezMIS Coordinator

Commented:
because you are comparing Const G_Drive = "cn=cadarch_ro" vs  "Cadarch_Full"
Melinda Burnscomputer support

Author

Commented:
I did make a copy of the script and placed it on his desktop.  I did not write the script so i am not sure what part of the script to change.
Melinda Burnscomputer support

Author

Commented:
I can run the script and watch it delete the mapped drives per the script and watch it remap all the other drives except the G:Drive.
Juan Jose PerezMIS Coordinator

Commented:
only this:

Const G_Drive = "cn=cadarch_ro"

for this

Const G_Drive = "cn=cadarch_full"

and run it
Have you checked the \\GE-H1\ and  \\GE-H1\cadarch shares again user account.  All the permissions are there?
Melinda Burnscomputer support

Author

Commented:
Ok I changed the first line from Const G_Drive = "cn=cadarch_ro"  to Const G_Drive = "cn=cadarch_full"

and it worked.  So why does it work on other users in the same group and not his.
Top Expert 2016

Commented:
Const G_Drive = "cn=cadarch_ro"
Const J_Drive="cn=commercial_ro"
Const M_Drive="cn=drafting_full"
Const X_Drive="cn=mep full"
Const R_Drive="cn=revit_full"

Set objNet = CreateObject("WScript.Network")
Set oShell = CreateObject("Shell.Application")
Set wshell = CreateObject("WScript.Shell")

Set objUser = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & objUser.UserName)
strGroup = LCase(Join(CurrentUser.MemberOf))

On Error Resume Next

wshShell.Run "%COMSPEC% /c net time ", 0, True

set wshell = Nothing

objNet.RemoveNetworkDrive "g:", True, True  
objNet.RemoveNetworkDrive "i:", True, True  
objNet.RemoveNetworkDrive "j:", True, True  
objNet.RemoveNetworkDrive "k:", True, True  
objNet.RemoveNetworkDrive "l:", True, True  
objNet.RemoveNetworkDrive "m:", True, True  
objNet.RemoveNetworkDrive "n:", True, True  
objNet.RemoveNetworkDrive "o:", True, True
objNet.RemoveNetworkDrive "r:", True, True  
objNet.RemoveNetworkDrive "t:", True, True  
objNet.RemoveNetworkDrive "u:", True, True
objNet.RemoveNetworkDrive "w:", True, True
objNet.RemoveNetworkDrive "x:", True, True  
objNet.RemoveNetworkDrive "z:", True, True

objNet.MapNetworkDrive "h:", "\\GE-H1\Home\" & objNet.UserName
Drive = "H:\"
oShell.NameSpace(Drive).Self.Name = "Home"

objNet.MapNetworkDrive "i:", "\\GE-H1\tpl"
Drive = "i:\"
oShell.NameSpace(Drive).Self.Name = "TPL"

objNet.MapNetworkDrive "k:", "\\GE-H1\data"
Drive = "k:\"
oShell.NameSpace(Drive).Self.Name = "Data"

objNet.MapNetworkDrive "l:", "\\GE-H1\complete\" & objnet.UserName
Drive = "l:\"
oShell.NameSpace(Drive).Self.Name = "Complete"

objNet.MapNetworkDrive "n:", "\\GE-H1\name\" & objNet.UserName
Drive = "n:\"
oShell.NameSpace(Drive).Self.Name = "Name"

objNet.MapNetworkDrive "o:", "\\GE-H1\common"
Drive = "o:\"
oShell.NameSpace(Drive).Self.Name = "Common"

objNet.MapNetworkDrive "t:", "\\GE-H1\img_data"
Drive = "t:\"
oShell.NameSpace(Drive).Self.Name = "Img Data"

objNet.MapNetworkDrive "u:", "\\GE-H1\jismn"
Drive = "u:\"
oShell.NameSpace(Drive).Self.Name = "JISMN"

objNet.MapNetworkDrive "z:", "\\GE-H1\archive"
Drive = "z:\"
oShell.NameSpace(Drive).Self.Name = "JIS Archive"

If InStr(strGroup, lcase(R_Drive)) Then
objNet.MapNetworkDrive "r:", "\\GE-H1\revit"
Drive = "r:\"
oShell.NameSpace(Drive).Self.Name = "Revit"
End If

If InStr(strGroup, lcase(G_Drive)) Then
objNet.MapNetworkDrive "g:", "\\GE-H1\cadarch"
Drive = "g:\"
oShell.NameSpace(Drive).Self.Name = "Cadarch"
End If

If InStr(strGroup, lcase(J_Drive)) Then
objNet.MapNetworkDrive "j:", "\\GE-H1\commercial"
Drive = "j:\"
oShell.NameSpace(Drive).Self.Name = "Commercial"
End If

If InStr(strGroup, lcase(M_Drive)) Then
objNet.MapNetworkDrive "m:", "\\GE-H1\drafting\libio"
Drive = "m:\"
oShell.NameSpace(Drive).Self.Name = "Libio"
End If

If InStr(strGroup, lcase(X_Drive)) Then
objNet.MapNetworkDrive "x:", "\\GE-H1\MEP"
Drive = "x:\"
oShell.NameSpace(Drive).Self.Name = "MEP"
End If 

Open in new window


is the user a member of group G_Drive
Melinda Burnscomputer support

Author

Commented:
David Johnson --  yes he is.
MIS Coordinator
Commented:
the script is looking for "cadarch_ro" not for "cadarch_full" , can you have the other users has a group that point to cadarch_ro?
Melinda Burnscomputer support

Author

Commented:
NLD_MIS   I am not sure what you are asking
Juan Jose PerezMIS Coordinator

Commented:
can you check if the users that has access to G_drive has another group that point or are member of cadarch_ro?
Melinda Burnscomputer support

Author

Commented:
Ok. That was it. They were all in the Cadarch_RO group and he wasn't.  Once i added him and rebooted, his drive mapped.  Thank you all so much
Melinda Burnscomputer support

Author

Commented:
Thank you for all the support.
Juan Jose PerezMIS Coordinator

Commented:
please click Accept Solution in the comment.

regards

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial