|
|
|||||||
Hi All Newby at this so I will apologise now. Over the summer break we upgrade a domain network to Windows Server 2016 and devices all to Windows 10. The issue we are having is when a user logs in they don't get the printers from the login script when opening Word or Excel, etc.. However if they log in to Office 365 on the same login session then they do?? If they log off and back on again the printers are there. We run the domain with mandatory profiles. When checking the debug file we get this: Choosing printer(s): 08:10:35 Connecting to printer(s): 08:10:35 Printer 0 is kyocerareception0 Printer 1 is \\local\cutepdf1722-1 We have noticed the line: Printer 0 is kyocerareception0 has 87 at the end when the printers don't show, if this means anything. We have our printers in a .csv file see below: lap-staff-*,photocopier,kyocerareception,\\local\cutepdf pc-staff-*,kyocerareception,photocopier,\\local\cutepdf *,\\local\cutepdf We have checked the share names against these name and they are correct. This is the adding printer from the KIX script: Code: ; --------------- Choose printer from CSV ------------ ; ---------------------------------------------------- ? "Choosing printer(s): @time" ; Default printer $printer="CutePDF" Dim $printers[10] $found=0 $hand=freefilehandle() if $hand>0 and open($hand,"$pdc\netlogon\printers.csv") = 0 $d=readline($hand) while @ERROR = 0 AND $found=0 $p=split($d,",",10) $as=instr($p[0],"*") if $as > 0 if substr($p[0],1,$as-1)=substr($name,1,$as-1) $found=1 Endif Else if $p[0]=$name $found=1 Endif Endif If $found=1 $printer=$p[1] $count=ubound($p) IF $count > 1 FOR $k = 2 TO $count $printers[$k-2]=$p[$k] Next endif endif $d=readline($hand) loop $d=close($hand) If @ERROR ? "Error parsing printers.csv (@ERROR)" Endif else ? "Could not open $pdc\netlogon\printers.csv (@ERROR)" endif If $found=0 $def=" by default" Else $def="" Endif ? "Connecting to printer(s): @time" $count=ubound($printers) IF $count > 1 FOR $k = 0 TO $count $pr=$printers[$k] IF $pr<>"" ? "Printer $k is $pr" ; If not a UNC path assume is on default printer server if substr($pr,1,2)="\\" addprinterconnection($pr) else if $print<>"" addprinterconnection("\\$print\$pr") else addprinterconnection("$pr") endif endif endif Next endif if substr($printer,1,2)="\\" if lcase(substr($printer,3,6))="local\" $p=substr($printer,9) $dum=setdefaultprinter("$p") ? "Printing on local printer $p" else if addprinterconnection($printer)=0 $dum=setdefaultprinter("$printer") ? "Printing on $printer$def" messagebox("Printing on $printer$def",$uname,0,$timeout) else ? "Could not select printer $printer (@ERROR)" messagebox("Could not select printer $printer (@ERROR)",$uname,0,$timeout) endif endif else if $print<>"" if addprinterconnection("\\$print\$printer")=0 $dum=setdefaultprinter("\\$print\$printer") messagebox("Printing on $printer$def",$uname,0,$timeout) else messagebox("Could not select printer $printer (@ERROR)",$uname,0,$timeout) endif else $port=readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\$printer","Port") $dum=writevalue("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows","Device","$printer,winspool,$port","REG_SZ") messagebox("Printing on $printer$def",$uname,0,$timeout) endif endif ; ---------------------------------------------------- If you need any more information please ask. Many thanks in advance. Gary |
||||||||
|
|
|||||||
Hi Gary and welcome, Error 87 means that "the Parameter is incorrect" But as you state, that Printers are being connected on the second logon or by starting Office 365, I assume that you have some Default Network logon 'optimizations' at work that often do no good You may try to set GPOs either for "Always wait for the network at computer startup and logon" or "Run logon scripts synchronously" (Alltough the latter might not work with mandatory profiles. Can't verify at the Moment) hth Jochen |
||||||||
|
|
|||||||
Can't say if this is the issue or not but I'd watch for vars and macros in strings, then test the results again. |
||||||||
|
|
|||||||
Hi Guys Thanks for the replies, I have been trying to reply but couldn't get on the website for some reason. I will give it a try and post back my result. Thanks Gary |