cheesebugah
asked on
VBScript Logon Script
Hello,
I am having a little trouble with mapped drives and our logon script. It appears to me that the portion of our logon script that maps the users' home directories is not working. If I use AD to do this, I get the home drive, but users who connect remotely, do not. I'm thinking I need to change my logon script or something. If I take away the AD connection to the home folder and just use the logon script, no home drive, even though there is a routine in the logon script that is supposed to map the drive. I've included the code from my logon script up to stuff that really doesn't pertain to this situation. If we need more, let me know.
Thanks,
Cheese
I am having a little trouble with mapped drives and our logon script. It appears to me that the portion of our logon script that maps the users' home directories is not working. If I use AD to do this, I get the home drive, but users who connect remotely, do not. I'm thinking I need to change my logon script or something. If I take away the AD connection to the home folder and just use the logon script, no home drive, even though there is a routine in the logon script that is supposed to map the drive. I've included the code from my logon script up to stuff that really doesn't pertain to this situation. If we need more, let me know.
Thanks,
Cheese
Option Explicit
Dim objNetwork, objSysInfo, strUserDN
Dim objGroupList, objUser, objFSO
Dim strComputerDN, objComputer
Dim strHomeShare, strHomeDrive
Dim ComputerName
Set objNetwork = CreateObject("Wscript.Network")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objSysInfo = CreateObject("ADSystemInfo")
strUserDN = objSysInfo.userName
strComputerDN = objSysInfo.computerName
' Bind to the user and computer objects with the LDAP provider.
Set objUser = GetObject("LDAP://" & strUserDN)
Set objComputer = GetObject("LDAP://" & strComputerDN)
' Map user home directory.
strHomeShare = objUser.homeDirectory
If (strHomeShare <> "") Then
strHomeDrive = objUser.homeDrive
If (strHomeDrive = "") Then
strHomeDrive = "H:"
End If
On Error Resume Next
objNetwork.MapNetworkDrive strHomeDrive, strHomeShare
If (Err.Number <> 0) Then
On Error GoTo 0
objNetwork.RemoveNetworkDrive strHomeDrive, True, True
objNetwork.MapNetworkDrive strHomeDrive, strHomeShare
End If
On Error GoTo 0
End If
I am confused. If you are removing the Home Directory from the AD account then why are you trying to map it based on Information you are pulling from the homDrive atribute it will return an empty value that may be your problem.
ASKER
jfinner2,
We have an issue here on our network, when people who have been connected to the network, VPN into the network from afar, their H drive is not getting mapped through the VPN. I was leaning toward using the login script instead of AD to map users' drives, thinking that might be the issue. I was testing it on my machine. I removed the H drive from my AD account and logged into the network, but did not get my H drive via the login script either. So, I think there is something messed up with the login script. Does that make it any clearer or have I confused you even more?
Thanks,
Cheese
We have an issue here on our network, when people who have been connected to the network, VPN into the network from afar, their H drive is not getting mapped through the VPN. I was leaning toward using the login script instead of AD to map users' drives, thinking that might be the issue. I was testing it on my machine. I removed the H drive from my AD account and logged into the network, but did not get my H drive via the login script either. So, I think there is something messed up with the login script. Does that make it any clearer or have I confused you even more?
Thanks,
Cheese
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I just wanted to update this question. We are working on the login script and am leaning toward manually mapping a user's H drive and unchecking the AD Home folder under the user's profile in AD. It worked for me.
Thanks,
Cheese
Thanks,
Cheese
You should uncheck the H drive mapping in their AD profile. What will happen when they logon on a pc local to your network? No H drive?
ASKER
Each user has their own computer. Yes, I have unchecked the radio button in AD for the user's profile to connect to a home folder. I then manually mapped it. The user is going to check it in the next couple of days.
Ok I was just looking at what if someone was logging on local to your domain from another PC. Although you wont cause a problem if you manually mapp and leave it checked
ASKER
jfinner2,
Thank you for your help on this matter. This has been driving us crazy for a long time. I have always been suspicious of the AD profile setting, but just haven't had a chance to test it. We're not busy or nothing. Anyway, I will let you know how it goes in the next day or two. We are going to be going to a Citrix desktop environment instead of VPN soon, so this won't be an issue through the VPN when we're done with that.
Thanks,
Cheese
Thank you for your help on this matter. This has been driving us crazy for a long time. I have always been suspicious of the AD profile setting, but just haven't had a chance to test it. We're not busy or nothing. Anyway, I will let you know how it goes in the next day or two. We are going to be going to a Citrix desktop environment instead of VPN soon, so this won't be an issue through the VPN when we're done with that.
Thanks,
Cheese
ASKER
The solution that worked best for me in this situation was to uncheck the AD home folder mapping in AD and then manually map the user's home folder making sure "reconnect at logon" is checked, which is the default. I have had no further isses since.
Thanks,
Cheese
Thanks,
Cheese