Posted October 15, 200816 yr I'm the Tech Director at a school and we use Windows 2003 Server to pass scripts to clients on login depending on user and location. Everything worked well for a year with clients but this year our 4th grade class has been having sporadic problems. The general 'share' folder that all users have always works for these users, but around 20% of the time their individual user mapped-drive does not show up. It is not dependent on machine or user but seems random. Most times the user can logout and log back in and it maps their network drive properly. I'm no script expert (the one we use was created by a consultant) but I would appreciate any help or suggestions that anyone might provide. Kixtart Script: DEBUG "ON" MessageBox("Running Logon Script", "ASDS",0, 2) Functions this function will delete *all* network printers function DelPrinterConnections() dim $c,$bk,$conn $c=0 $bk="HKEY_CURRENT_USER\Printers\Connections" $conn=enumkey($bk,$c) while @error=0 $c=$c+0.5 $conn=delkey($bk+"\"+$conn) $conn=enumkey($bk,$c) loop endfunction this function will only delete network printers from 2kserv01 /* function Del2kserv01Printers() dim $c,$bk,$conn $c=0 $bk="HKEY_CURRENT_USER\Printers\Connections" $conn=enumkey($bk,$c) while @error=0 $c=$c+0.5 if instr($conn, "2kserv01") > 0 $conn=delkey($bk+"\"+$conn) endif $conn=enumkey($bk,$c) loop endfunction */ Mapping Network Drives remove all exiting mapped drive letters USE "*" /DELETE /PERSISTENT individually delete s: and v: did not work USE s: /delete USE v: /delete USE s: "\\saints\share" /persistent IF InGroup("teachers") USE V: "\\saints\users\teachers\" + @USERID ENDIF IF InGroup("class2007") USE V: "\\saints\users\students\class of 2007\" + @USERID ENDIF IF InGroup("Class of 2008") USE V: "\\saints\users\students\class of 2008\" + @USERID ENDIF IF InGroup("Class of 2009") USE V: "\\saints\users\students\class of 2009\" + @USERID ENDIF IF InGroup("Class of 2010") USE V: "\\saints\users\students\class of 2010\" + @USERID ENDIF IF InGroup("Class of 2011") USE V: "\\saints\users\students\class of 2011\" + @USERID ENDIF IF InGroup("Class of 2012") USE V: "\\saints\users\students\class of 2012\" + @USERID ENDIF IF InGroup("Class of 2013") USE V: "\\saints\users\students\class of 2013\" + @USERID ENDIF IF InGroup("Class of 2014") USE V: "\\saints\users\students\class of 2014\" + @USERID ENDIF IF InGroup("Class of 2015") USE V: "\\saints\users\students\class of 2015\" + @USERID ENDIF IF InGroup("Class of 2016") USE V: "\\saints\users\students\class of 2016\" + @USERID ENDIF IF InGroup("Class of 2017") USE V: "\\saints\users\students\class of 2017\" + @USERID ENDIF IF InGroup("Class of 2018") USE V: "\\saints\users\students\class of 2018\" + @USERID ENDIF Printer Assignment delete any network printers connected to theold server, 2kserv01 Del2kserv01Printers() determine if a computer in in the lab or in the library $in_lab = 0 $in_lib = 0 $in_laptop = 0 $err = 0 $all_grps = GetObject("WinNT://" + @domain + "/" + @wksta + "$$" ) for each $grp in $all_grps.Groups MessageBox($grp.Name,"Groups",0) if $grp.Name = "labgrp" $in_lab = 1 endif if $grp.Name = "libgrp" $in_lib = 1 endif if $grp.Name = "laptopgrp" $in_laptop = 1 endif next computer lab IF $in_lab = 1 MessageBox("In the lab", @HOSTNAME, 0 ) DelPrinterConnections() $rv = AddPrinterConnection("\\saints\LabDell3100") if $rv <> 0 MessageBox("Could not use the Lab Color Laser 3100:" + $rv,"Error",0,2) $err = $err + 1 endif $rv = AddPrinterConnection("\\saints\LabHP2200") if $rv <> 0 MessageBox("Could not connect to printer: Lab HP 2200:" + $rv + @CRLF + @SError,"Error",0,2) $err = $err + 1 endif kixtart SetDefaultPrinter() does not seem to work sleep 0.5 Run "c:\windows\system32\cscript.exe //nologo \\asds1.local\netlogon\default_lab_prtr.vbs" endif library IF $in_lib = 1 MessageBox("In the library", @HOSTNAME, 0 ) DelPrinterConnections() $rv = AddPrinterConnection("\\saints\LibraryColor") if $rv <> 0 MessageBox("Could not connect to: Library Color Laser Printer 3100:" + $rv + @CRLF + @Serror,"Error",0,2) $err = $err + 1 endif $rv = AddPrinterConnection("\\saints\LibraryLaser1700") if $rv <> 0 MessageBox("Could not connect to: Library Laser Printer 1700:" + $rv + @CRLF + @Serror,"Error",0,2) $err = $err + 1 endif sleep 0.5 Run "c:\windows\system32\cscript.exe //nologo \\asds1.local\netlogon\default_lib_prtr.vbs" endif laptop computers if $in_laptop = 1 MessageBox("Is a laptop", @HOSTNAME, 0 ) DelPrinterConnections() $rv = AddPrinterConnection("\\saints\LabDell3100") if $rv <> 0 MessageBox("Could not use the Lab Color Laser 3100:" + $rv, "Error", 0, 2) $err = $err + 1 endif $rv = AddPrinterConnection("\\saints\LabHP2200") if $rv <> 0 MessageBox("Could not connect to: Lab HP 2200:" + $rv + @CRLF + @SError, "Error",0,2) $err = $err + 1 endif $rv = AddPrinterConnection("\\saints\LibraryColor") if $rv <> 0 MessageBox("Could not connect to: Library Color Laser Printer 3100:" + $rv + @CRLF + @Serror,"Error",0,2) $err = $err + 1 endif $rv = AddPrinterConnection("\\saints\LibraryLaser1700") if $rv <> 0 MessageBox("Could not connect to printer: Library Laser Printer 1700:" + $rv + @CRLF + @Serror,"Error",0,2) $err = $err + 1 endif sleep 0.5 Run "c:\windows\system32\cscript.exe //nologo \\asds1.local\netlogon\default_lib_prtr.vbs" endif Icon Management change out office icons, remove old ones, copy down good ones from the server del "c:\Documents and Settings\@USERID\Desktop\New Office Document.lnk" del "c:\Documents and Settings\@USERID\Desktop\Microsoft Publisher.lnk" del "c:\Documents and Settings\@USERID\Desktop\Microsoft PowerPoint.lnk" del "c:\Documents and Settings\@USERID\Desktop\Microsoft Word.lnk" del "c:\Documents and Settings\@USERID\Desktop\New Microsoft Word Document.doc" del "c:\Documents and Settings\@USERID\Desktop\Shortcut to WINWORD.lnk" del "c:\Documents and Settings\@USERID\Desktop\Shortcut to ccopac.lnk" copy "\\saints\netlogon\icons_global\*.lnk" "c:\Documents and Settings\@USERID\Desktop\" if $in_lib = 1 copy "\\saints\netlogon\icons_lib\*.lnk" "c:\Documents and Settings\@USERID\Desktop\" endif if $in_lab = 1 copy "\\saints\netlogon\icons_lab\*.lnk" "c:\Documents and Settings\@USERID\Desktop\" endif -- samhale ------------------------------------------------------------------------ samhale's Profile: http://forums.techarena.in/members/samhale.htm View this thread: http://forums.techarena.in/windows-server-help/1055521.htm http://forums.techarena.in
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.