#205559 - 2012-08-22 04:56 PM
Activate Mapped Drives at Logon?
|
JD12
Fresh Scripter
Registered: 2012-08-16
Posts: 5
Loc: Milwaukee, WI
|
I am using a very basic script to map multiple network drives for users. All users are now on Win7 connecting to Win2K8 R2 DC's. The drive mappings work but most of the drives are not active (Red X'd out) until the user manually selects the drive. This causes some problems when an application attempts to read from the mapped drive but it hasn't been activated by the user. I've ready alot about this issue in the MS forums but have found no reliable fix. Can anyone here recommend an easy way to activate the drives from within the .kix file? Thanks in advance, Joe
|
Top
|
|
|
|
#205564 - 2012-08-23 03:39 PM
Re: Activate Mapped Drives at Logon?
[Re: ShaneEP]
|
JD12
Fresh Scripter
Registered: 2012-08-16
Posts: 5
Loc: Milwaukee, WI
|
Thanks for the reply. I am deleting the mappings each time before mapping them again. This appears to be a known issue with Win7, where the drive mappings are read and processed before the network connection is completely established. I've made all the MS-recommended changes in group policy processing, etc. but with no effect. I'm hoping for an option in the script where I could enumerate the drive or such that would activate the connection before the user had time to open an application.
Here's the sanitized version of my script:
;Drive mapping script for the IS department
USE G: /DEL
USE G: @HOMESHR ;Map G: to the users home directory
USE H: /DEL
USE H: "\\Server2\IS"
USE T: /DEL
USE T: "\\Server8\df"
USE X: /DEL
USE X: "\\Server2\SNOOPY" /persistent:yes
USE W: /DEL ; disconnect W: TS.2 WINTEG
Color y+/n
AT ( 9,40) @userid
AT (10,40) @fullname
AT (11,40) @priv
AT (12,40) @wksta
AT (13,40) @domain
AT (14,40) @lserver
Color w/n
RETURN
Thanks, Joe
Edited by Mart (2012-08-23 04:05 PM) Edit Reason: Please use code tags when posting code.
|
Top
|
|
|
|
#205565 - 2012-08-23 04:01 PM
Re: Activate Mapped Drives at Logon?
[Re: Allen]
|
JD12
Fresh Scripter
Registered: 2012-08-16
Posts: 5
Loc: Milwaukee, WI
|
I'm pretty sure this is not an AV (McAfee) issue given the number of reported issues out there, but thanks for the thought.
|
Top
|
|
|
|
#205589 - 2012-08-26 05:40 PM
Re: Activate Mapped Drives at Logon?
[Re: Mart]
|
Robdutoit
Hey THIS is FUN
 
Registered: 2012-03-27
Posts: 363
Loc: London, England
|
hi there JD12, I also work with domains and use kixtart as a login script. I have actually spent the last few months completing rebuilding my script to make it 100% compatiblie with Windows 7 and Server 2008 standard. I remember having the same problem that you have and if memory serves me correctly the problem was caused by the drives being mapped persistently. But I cannot remember for sure, so what I will do is give you the coding that I use and the steps that I have taken in my new script as I don't have this issue in the new script.
1. Run the script from the group policy. I used to in the old days run my script from the netlogon folder. This causes a lot of issues with windows 7. You need to run it from a gpo. 2. Use the latest kixtart script as this take into account any changes with windows 7. 3. When calling from a gpo you need to call the file kix32.exe and you need to specify that you are calling the kixtart.kix script otherwise it does not run. this issue is specific to the latest version of kixtart. I did not have this issue with earlier versions. It used to just run kixtart.kix without me having to specify the file to be called. 4.Do not use persistent drives (as I think that this was the cause when I had the problem). To ensure that you don't have persistent drives, disable your script, logoff and logon again. If the drives are still there, you have a persistent setting somewhere. try looking in the registry setting ("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Network\Persistent Connections", "SaveConnections", "No","REG_SZ")
5. I had an issue with windows 7 not mapping the drives at all, if I run it from the gpo. It worked perfectly if I ran the script manually while logged on, but it did not work when the script ran on login. You need to add the following code for windows 7
("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLinkedConnections", "1", "REG_DWORD")
I also found that sometimes settings were not being applied consistently and I came to the conclusion that the script was writing settings to the registry before the user key was loaded, so the settings were not being applied. To correct this, I told the script to wait till the user ID was loaded, then continue loading the script. I don't believe that this is causing your problem, but it may be worth your while to add. Put this right at the beginning of your script, so that it will wait for the User ID to be loaded then run your script. ? "User logged on is " @Userid while @USERID = "" sleep 300 ? "sleeping for 300 milliseconds" loop
You may have a problem with your network card drivers. Try updating to the latest version as you may have an issue where the network card driver seems to lose the connection. I had this and I had to change from version 6.00 to version 6.20 for the realteak card, but I had to manually select the driver rather than have windows choose my driver. I doubt that is your problem, because you are obviously having the issue where the x appears straight on login, but its always worthwhile to update the network card drivers.
I believe that your problem is that your drives are set to be persistent. With regards to your script, if you do not have persistent drives, there is no need to delete the drives at all. when you logoff the drives will automatically be deleted. so get rid of the part of your script where you are deleting the mapped drives as this is not required. Hope that my answer helps somewhat
|
Top
|
|
|
|
#205606 - 2012-08-29 02:49 PM
Re: Activate Mapped Drives at Logon?
[Re: Robdutoit]
|
JD12
Fresh Scripter
Registered: 2012-08-16
Posts: 5
Loc: Milwaukee, WI
|
Robdutoit, thanks much for the detailed response. And thanks everyone for the other clarifications. I will be working on this over the next couple of weeks as time permits. I will post back my results.
Cheers, Joe
|
Top
|
|
|
|
#205607 - 2012-08-29 03:58 PM
Re: Activate Mapped Drives at Logon?
[Re: Robdutoit]
|
JD12
Fresh Scripter
Registered: 2012-08-16
Posts: 5
Loc: Milwaukee, WI
|
Robdutoit, would you have a sample of the code you're using in your script? Thanks, Joe
|
Top
|
|
|
|
#205609 - 2012-08-29 06:37 PM
Re: Activate Mapped Drives at Logon?
[Re: JD12]
|
Robdutoit
Hey THIS is FUN
 
Registered: 2012-03-27
Posts: 363
Loc: London, England
|
I use a function that I created called checkandsetregvalue which is self explanatory. This sets the necessary registry settings for my mapped drives to work
;================================================================================================ ; Checks the registry value and if incorrect, it applies correct setting, otherwise says already applied ;================================================================================================
Function CheckAndSetRegValue($RegPath, $RegValue, $RegData, $RegType) $ReturnValue = ReadValue($RegPath, $RegValue) If ($ReturnValue = $RegData) ; ? "Registry value already applied:" ; ? "Path: " + $RegPath ; ? "Value: " + $RegValue ; ? "RegData: " + $RegData ; ? "Value Type: " + $RegType Else WriteValue($RegPath, $RegValue, $RegData, $RegType) ; ? "Registry value is being set for: " ; ? "Path: " + $RegPath ; ? "Value: " + $RegValue ; ? "RegData: " + $RegData ; ? "Value Type: " + $RegType EndIf EndFunction
;================================================================= ; Delete Persistent Network connections ie mapped drives ;=================================================================
CheckAndSetRegValue ("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Network\Persistent Connections", "SaveConnections", "No","REG_SZ")
;====================================================================================================== ;This setting fixes a problem with mapped drives not working with domain users in windows 7 - something to do with uac ;======================================================================================================
CheckAndSetRegValue($HKLMSOFT + "\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLinkedConnections", "1", "REG_DWORD")
;============================================================= ; Maps user drives ;=============================================================
Use X: $ServerName + "\software"
If ingroup ("managers") or ingroup ("office") = 1 ? "Do not map P drive as don't need for these users" Else
;================================================================= ; Mapping the P: drive for staff and pupils ;=================================================================
Use P: $ServerName + "\shared\access" Endif
Allen has mentioned that one should not use "EnableLinkedConnections", so you might want to look up his alternative that he suggested. I have not had time to look into that as yet.
On my test server (windows 2008 server) I have noticed the problem with the red crossed on drives that I have manually mapped on my server (with the setting to map again for every logon. This is not a script issue, its a windows vista/7 issue to do with persistent mappings.
Rob
Edited by Robdutoit (2012-08-29 06:39 PM) Edit Reason: forgot to wrap only code in quotes
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 418 anonymous users online.
|
|
|