Hello, I posted the below in Windows 2003 Server Forum, but they have asked me to post it here.
I have a Windows 2003 Server and about 30 XP Clients. I've configured user profile to map a home folder, drive H: What happens is that sometimes the H: drive shows up and sometimes it doesn't. I'm not quite sure why. I also use a login script through group policy. The script i use is from tek-tips Everythings is working, except for the H: not showing at times. I've tried to comment out, Disconnect all drives from the login script, i thot maybe it's being disconnected by the script. But the problem remains. Sorry for the long post.
Thanks for the help in advance.
Below are three problems I can't seem to reslove.
1)I still have the same problem where H: drive doesn't show up "somtimes", which is mapped through User Profile in AD.
2) The links that are mapped through the script below are sometimes not accessible. I get the the following message. "The referenced account is currently locked out and may not be logged on to." To make them work, i have to restart the computer. This problem was only on my computer initially and today one other user had the same prob.
3) Sometime H: (mapped through User Profiles) and K: (mapped using the script below) point to the same directories!!
All these problems are random. Please HELP, what the hell is going on, what am i doing wrong?!?! Below is the script I use.
'==========================================================
' NAME: LogonScript.vbs
'
' AUTHOR:
'
'COMPANY:
'==========================================================
'
'
ON ERROR RESUME NEXT
'
Dim WSHShell, WSHNetwork, objDomain, DomainString, UserString, UserObj, Path
'
'
Set WSHShell = CreateObject("WScript.Shell")
Set WSHNetwork = CreateObject("WScript.Network")
Set objDomain = getObject("LDAP://rootDse")
DomainString = objDomain.Get("dnsHostName")
'
UserString = WSHNetwork.UserName
'Bind to the user object to get user name and check for group memberships later
Set UserObj = GetObject("WinNT://" & DomainString & "/" & UserString)
'
'==========================================================
'Synchronizes the time with Server our NTP Server
'WSHShell.Run "NET TIME \\FLSHQ /set /y"
'==========================================================
'
'
'
'==========================================================
'Disconnect any drive mappings as needed.
'WSHNetwork.RemoveNetworkDrive "G:"
'WSHNetwork.RemoveNetworkDrive "J:"
'WSHNetwork.RemoveNetworkDrive "K:"
'WSHNetwork.RemoveNetworkDrive "L:"
'WSHNetwork.RemoveNetworkDrive "M:"
'WSHNetwork.RemoveNetworkDrive "N:"
'WSHNetwork.RemoveNetworkDrive "O:"
'WSHNetwork.RemoveNetworkDrive "P:"
'WSHNetwork.RemoveNetworkDrive "R:"
'WSHNetwork.RemoveNetworkDrive "S:"
'WSHNetwork.RemoveNetworkDrive "T:"
'WSHNetwork.RemoveNetworkDrive "W:"
'WSHNetwork.RemoveNetworkDrive "X:"
'WSHNetwork.RemoveNetworkDrive "Y:"
'==========================================================
'
'
'==========================================================
'Disconnect ALL mapped drives
Set clDrives = WshNetwork.EnumNetworkDrives
For i = 0 to clDrives.Count -1 Step 2
WSHNetwork.RemoveNetworkDrive clDrives.Item(i)
Next
'
'Give the PC time to do the disconnect, wait 300 milliseconds
wscript.sleep 300
'==========================================================
'
'
'
'==========================================================
'Map drives needed by all
WSHNetwork.MapNetworkDrive "K:", "\\Flcluster\HomeFolders",True
WSHNetwork.MapNetworkDrive "R:", "\\Flcluster\Research",True
WSHNetwork.MapNetworkDrive "G:", "\\Flcluster\General Share",True
WSHNetwork.MapNetworkDrive "P:", "\\Flcluster\Pictures",True
'==========================================================
'
'
'
'==========================================================
'Now check for group memberships and map appropriate drives
For Each GroupObj In UserObj.Groups
Select Case GroupObj.Name
'Check for group memberships and take needed action
'In this example below, IT Admin and Accounting are groups.
'
Case "IT Admin"
WSHNetwork.MapNetworkDrive "N:", "\\cluster\Information Technology",True
WSHNetwork.MapNetworkDrive "W:", "\\cluster\Software",True
Case "Accounting"
WSHNetwork.MapNetworkDrive "J:", "\\cluster\Accounting",True
WSHNetwork.MapNetworkDrive "T:", "\\cluster\data",True
Case "Marketing"
WSHNetwork.MapNetworkDrive "M:", "\\cluster\Marketing",True
Case "Sales"
WSHNetwork.MapNetworkDrive "S:", "\\cluster\Sales",True
Case "Human Resources"
WSHNetwork.MapNetworkDrive "X:", "\\cluster\Human Resources",True
Case "Administration"
WSHNetwork.MapNetworkDrive "Y:", "\\cluster\Administration",True
WSHNetwork.MapNetworkDrive "N:", "\\cluster\Information Technology",True
Case "Legal"
WSHNetwork.MapNetworkDrive "L:", "\\cluster\Partnerships & Corporations",True
Case "FLWMS"
WSHNetwork.MapNetworkDrive "O:", "\\cluster\FLWMS",True
End Select
'
Next
'==========================================================
'
'
'
'==========================================================
'Remove ALL old printers
'Enumerate all printers first, after that you can select the printers you want by performing some string checks
'Set WSHPrinters = WSHNetwork.EnumPrinterConnections
'For LOOP_COUNTER = 0 To WSHPrinters.Count - 1 Step 2
'To remove only networked printers use this If Statement
' If Left(WSHPrinters.Item(LOOP_COUNTER +1),2) = "\\" Then
' WSHNetwork.RemovePrinterConnection WSHPrinters.Item(LOOP_COUNTER +1),True,True
' End If
'==========================================================
'
'
'
'
'==========================================================
'To remove all printers incuding LOCAL printers use this statement and comment out the If Statement above
'WSHNetwork.RemovePrinterConnection WSHPrinters.Item(LOOP_COUNTER +1),True,True
'Next
'==========================================================
'
'
'
'==========================================================
'Remove a specific printer
'WSHNetwork.RemovePrinterConnection "\\ServerOld\HP5si",True,True
'==========================================================
'
'
'
'==========================================================
'Install Printers
'WSHNetwork.AddWindowsPrinterConnection "\\Server\HP5si"
'WSHNetwork.AddWindowsPrinterConnection "\\Flcluster\HP LaserJet 1200 Series PCL"
'==========================================================
'
'
'
'==========================================================
' This section of script will prevent the baloon window that appears when printing
' to a network shared printer after XP Service Pack 2 is installed.
'
Path = "HKCU\Printers\Settings\EnableBalloonNotificationsRemote"
WshShell.RegWrite Path, 0 ,"REG_DWORD"
'
'Clean Up Memory We Used
set UserObj = Nothing
set GroupObj = Nothing
set WSHNetwork = Nothing
set DomainString = Nothing
set WSHSHell = Nothing
Set WSHPrinters = Nothing
'==========================================================
'
'
'
'==========================================================
'Quit the Script
wscript.quit
'==========================================================
I have a Windows 2003 Server and about 30 XP Clients. I've configured user profile to map a home folder, drive H: What happens is that sometimes the H: drive shows up and sometimes it doesn't. I'm not quite sure why. I also use a login script through group policy. The script i use is from tek-tips Everythings is working, except for the H: not showing at times. I've tried to comment out, Disconnect all drives from the login script, i thot maybe it's being disconnected by the script. But the problem remains. Sorry for the long post.
Thanks for the help in advance.
Below are three problems I can't seem to reslove.
1)I still have the same problem where H: drive doesn't show up "somtimes", which is mapped through User Profile in AD.
2) The links that are mapped through the script below are sometimes not accessible. I get the the following message. "The referenced account is currently locked out and may not be logged on to." To make them work, i have to restart the computer. This problem was only on my computer initially and today one other user had the same prob.
3) Sometime H: (mapped through User Profiles) and K: (mapped using the script below) point to the same directories!!
All these problems are random. Please HELP, what the hell is going on, what am i doing wrong?!?! Below is the script I use.
'==========================================================
' NAME: LogonScript.vbs
'
' AUTHOR:
'
'COMPANY:
'==========================================================
'
'
ON ERROR RESUME NEXT
'
Dim WSHShell, WSHNetwork, objDomain, DomainString, UserString, UserObj, Path
'
'
Set WSHShell = CreateObject("WScript.Shell")
Set WSHNetwork = CreateObject("WScript.Network")
Set objDomain = getObject("LDAP://rootDse")
DomainString = objDomain.Get("dnsHostName")
'
UserString = WSHNetwork.UserName
'Bind to the user object to get user name and check for group memberships later
Set UserObj = GetObject("WinNT://" & DomainString & "/" & UserString)
'
'==========================================================
'Synchronizes the time with Server our NTP Server
'WSHShell.Run "NET TIME \\FLSHQ /set /y"
'==========================================================
'
'
'
'==========================================================
'Disconnect any drive mappings as needed.
'WSHNetwork.RemoveNetworkDrive "G:"
'WSHNetwork.RemoveNetworkDrive "J:"
'WSHNetwork.RemoveNetworkDrive "K:"
'WSHNetwork.RemoveNetworkDrive "L:"
'WSHNetwork.RemoveNetworkDrive "M:"
'WSHNetwork.RemoveNetworkDrive "N:"
'WSHNetwork.RemoveNetworkDrive "O:"
'WSHNetwork.RemoveNetworkDrive "P:"
'WSHNetwork.RemoveNetworkDrive "R:"
'WSHNetwork.RemoveNetworkDrive "S:"
'WSHNetwork.RemoveNetworkDrive "T:"
'WSHNetwork.RemoveNetworkDrive "W:"
'WSHNetwork.RemoveNetworkDrive "X:"
'WSHNetwork.RemoveNetworkDrive "Y:"
'==========================================================
'
'
'==========================================================
'Disconnect ALL mapped drives
Set clDrives = WshNetwork.EnumNetworkDrives
For i = 0 to clDrives.Count -1 Step 2
WSHNetwork.RemoveNetworkDrive clDrives.Item(i)
Next
'
'Give the PC time to do the disconnect, wait 300 milliseconds
wscript.sleep 300
'==========================================================
'
'
'
'==========================================================
'Map drives needed by all
WSHNetwork.MapNetworkDrive "K:", "\\Flcluster\HomeFolders",True
WSHNetwork.MapNetworkDrive "R:", "\\Flcluster\Research",True
WSHNetwork.MapNetworkDrive "G:", "\\Flcluster\General Share",True
WSHNetwork.MapNetworkDrive "P:", "\\Flcluster\Pictures",True
'==========================================================
'
'
'
'==========================================================
'Now check for group memberships and map appropriate drives
For Each GroupObj In UserObj.Groups
Select Case GroupObj.Name
'Check for group memberships and take needed action
'In this example below, IT Admin and Accounting are groups.
'
Case "IT Admin"
WSHNetwork.MapNetworkDrive "N:", "\\cluster\Information Technology",True
WSHNetwork.MapNetworkDrive "W:", "\\cluster\Software",True
Case "Accounting"
WSHNetwork.MapNetworkDrive "J:", "\\cluster\Accounting",True
WSHNetwork.MapNetworkDrive "T:", "\\cluster\data",True
Case "Marketing"
WSHNetwork.MapNetworkDrive "M:", "\\cluster\Marketing",True
Case "Sales"
WSHNetwork.MapNetworkDrive "S:", "\\cluster\Sales",True
Case "Human Resources"
WSHNetwork.MapNetworkDrive "X:", "\\cluster\Human Resources",True
Case "Administration"
WSHNetwork.MapNetworkDrive "Y:", "\\cluster\Administration",True
WSHNetwork.MapNetworkDrive "N:", "\\cluster\Information Technology",True
Case "Legal"
WSHNetwork.MapNetworkDrive "L:", "\\cluster\Partnerships & Corporations",True
Case "FLWMS"
WSHNetwork.MapNetworkDrive "O:", "\\cluster\FLWMS",True
End Select
'
Next
'==========================================================
'
'
'
'==========================================================
'Remove ALL old printers
'Enumerate all printers first, after that you can select the printers you want by performing some string checks
'Set WSHPrinters = WSHNetwork.EnumPrinterConnections
'For LOOP_COUNTER = 0 To WSHPrinters.Count - 1 Step 2
'To remove only networked printers use this If Statement
' If Left(WSHPrinters.Item(LOOP_COUNTER +1),2) = "\\" Then
' WSHNetwork.RemovePrinterConnection WSHPrinters.Item(LOOP_COUNTER +1),True,True
' End If
'==========================================================
'
'
'
'
'==========================================================
'To remove all printers incuding LOCAL printers use this statement and comment out the If Statement above
'WSHNetwork.RemovePrinterConnection WSHPrinters.Item(LOOP_COUNTER +1),True,True
'Next
'==========================================================
'
'
'
'==========================================================
'Remove a specific printer
'WSHNetwork.RemovePrinterConnection "\\ServerOld\HP5si",True,True
'==========================================================
'
'
'
'==========================================================
'Install Printers
'WSHNetwork.AddWindowsPrinterConnection "\\Server\HP5si"
'WSHNetwork.AddWindowsPrinterConnection "\\Flcluster\HP LaserJet 1200 Series PCL"
'==========================================================
'
'
'
'==========================================================
' This section of script will prevent the baloon window that appears when printing
' to a network shared printer after XP Service Pack 2 is installed.
'
Path = "HKCU\Printers\Settings\EnableBalloonNotificationsRemote"
WshShell.RegWrite Path, 0 ,"REG_DWORD"
'
'Clean Up Memory We Used
set UserObj = Nothing
set GroupObj = Nothing
set WSHNetwork = Nothing
set DomainString = Nothing
set WSHSHell = Nothing
Set WSHPrinters = Nothing
'==========================================================
'
'
'
'==========================================================
'Quit the Script
wscript.quit
'==========================================================