Help Configuring Group Policy Script
I've been searching and searching and searching and I've found a lot of related posts, but nothing so far seems to correct my issue. Though the problem does seem a bit unique. I don't have much experience with networking at all so maybe it's not so unique. Anyway, I am testing out a Windows 7 laptop on our network. I was able to join the domain just fine but the login script just doesn't perform the drive mappings. It doesn't really seem to be related to user's privilege level either. For my logon (I am a system administrator) it will only map one drive when I should have three. Another user (a standard user) doesn't have ANY drives mapped, and yet another standard user maps all but two (out of 7). I don't think we use GPOs to do this (but I'm not sure). We have 8 batch script files in C:\WINNT\SYSVOL\sysvol\<domain>\scripts which are set in the user profile depending on the user. The script runs on login but it halts on seemingly random drives for each user and prompts for username and a password. I've tried giving it authentication using both specific user credentials and our generic administrator account credentials. This just gives an error 1219 saying multiple connections to one resource by the same user are not allowed. Help! Please! Thank you all in advance.
February 3rd, 2010 11:15pm
I'm going to try using a Group Policy login script to see if it will work for Windows 7. I got the following script from Microsoft . I'm not quite sure of everything that needs to be changed to suit my network so I'm asking for some help in determining what parts of this script I need to change.
'=================================================
' Network Logon Script in VbScript
' Must be Modified to your network environment
'=================================================
Option Explicit
Dim objGroupList, objUser, strGroup, objNetwork, strNTName, WshShell
Dim NetBiosDomainName, strHomeDrive, strHomeShare
NetBiosDomainName = "YOURDOMAIN"
Set objNetwork = CreateObject("Wscript.Network")
strNTName = ""
On Error Resume Next
Do While strNTName = ""
strNTName = objNetwork.userName
Err.Clear
If Wscript.Version > 5 Then
Wscript.Sleep 100
End If
Loop
On Error GoTo 0
'====== Synchronizing local time with domain ======
On Error Resume Next
Set WshShell = WScript.CreateObject("Wscript.Shell")
WshShell.Run "%COMSPEC% /c net time /DOMAIN:" & NetBiosDomainName & " /SET /YES",0,true
'======== Bind user object in Active Directory ========
Set objUser = GetObject("WinNT://" & NetBiosDomainName & "/" & strNTName & ",user")
'======= Map network drive based on group membership ==
if IsMember("Accounting") then
MappedDrive "N:", "\\YOURSERVER\ACCOUNTING"
End if
'======== Map public drive ============================
MappedDrive "P:", "\\YOURSERVER\PUBLIC"
Greeting strNTName
Set objGroupList = Nothing
Set objUser = Nothing
Set objNetwork = Nothing
'=======================================================
' MappedDrive function
'=======================================================
Function MappedDrive (DriveLetter, SharedPath)
On Error Resume Next
If objNetwork.DriveExists(DriveLetter) Then
objNetwork.RemoveNetworkDrive DriveLetter, True, True
End If
On Error Resume Next
If objNetwork.DriveExists(SharedPath) Then
objNetwork.MapNetworkDrive DriveLetter, SharedPath
End if
End Function
'=======================================================
' IsMember function
'=======================================================
Function IsMember(strGroup)
If IsEmpty(objGroupList) Then
Call LoadGroups
End If
IsMember = objGroupList.Exists(strGroup)
End Function
'=======================================================
' LoadGroups function
'=======================================================
Sub LoadGroups
Dim objGroup
Set objGroupList = CreateObject("Scripting.Dictionary")
objGroupList.CompareMode = vbTextCompare
For Each objGroup In objUser.Groups
objGroupList(objGroup.name) = True
Next
Set objGroup = Nothing
End Sub
'=======================================================
' Greeting function
'=======================================================
Function Greeting(UserName)
dim POPUP_WAIT, Shell, Env, sDate, h, strMsg, GreetingTime
POPUP_WAIT = 3
Set Shell = WScript.CreateObject("WScript.Shell")
set Env = Shell.Environment("PROCESS")
sDate = Now
h = Hour(sDate)
if (h < 12) then
GreetingTime = "Good morning! "
elseif (h < 17) then
GreetingTime = "Good afternoon! "
else
GreetingTime = "Good evening! "
end if
strMsg = GreetingTime & UserName & ", Welcome to Corporate Network" & VbCrLf _
& "It is " & FormatDateTime(now(), VbLongTime) & " on " & GetTodayLongDate
Shell.Popup strMsg, POPUP_WAIT, "Login Script", 0
End Function
'=======================================================
' FormatLongDate Function
'=======================================================
Function GetTodayLongDate
Dim dDate
dDate = now()
GetTodayLongDate = WeekdayName(DatePart("w",dDate),0) & " " _
& MonthName(DatePart("m",dDate),1) & " " & DatePart("d",dDate) _
& ", " & DatePart("yyyy",dDate)
End Function
Obviously I need to change stuff like this "\\YOURSERVER\ACCOUNTING" to match my network drives, but what else is there I need to change. Thank you in advance for your help.
Free Windows Admin Tool Kit Click here and download it now
February 4th, 2010 8:26pm
Let us start with what you want to accomplish :)I suppose that you want to map network drives and maybe printers during logon. If you have domain controllers running Windows Server 2008 or later I suggest that you use Group Policy Preferences to map network drives and printers and totally skip using a classic logon script. Using Group Policy preferences is more failsafe and easier to manage as it is handled as a traditional GPO, with possibilites to assign it to specific groups or do WMI filtering etc. Read more on Group Policy Preferences at http://technet.microsoft.com/en-us/library/cc731892(WS.10).aspx
February 4th, 2010 9:44pm
We have a Windows 2000 Server for our Domain Controller and for Active Directory. The drives I need to map are on a Linux system. Can I still use the above script?
Free Windows Admin Tool Kit Click here and download it now
February 4th, 2010 10:04pm
I think I've got the script configured. Anyway, testing the script on the client I've discovered this doesn't solve my problems either. :( *sigh The script runs, but doesn't map some of the drives. It hangs for a bit then gives up. I only get one drive mapped on my administrator account, same as I did with our old way of doing login scripts. Is there no way to fix this?! Aaargh! This is driving me nuts!
February 4th, 2010 10:57pm
Hi,
Considering this issue is related to script and we have specific forum for this, it is recommended that you go to our Scripting Forum for further investigation.
Thanks.
Nicholas Li - MSFT
Free Windows Admin Tool Kit Click here and download it now
February 10th, 2010 1:35pm
No this isn't a scripting problem. I merely wanted a little help in figuring out what parts of the script were domain specific so I could change them and see if this script would work instead of our batch scripts. I was able to figure out what I needed and got the script working. However, it didn't solve the problem we were having with our batch scripts which is outlined here: http://social.technet.microsoft.com/Forums/en-US/w7itpronetworking/thread/cd459491-dd7a-417a-83e7-a528462efd93 Tell me, MS, why is something that's so commonly done so hard (no, impossible ) to do!
February 10th, 2010 11:35pm