Page 1 of 1 1
Topic Options
#213744 - 2019-09-16 03:39 PM Printing on new server
GBMicros Offline
Just in Town

Registered: 2019-09-16
Posts: 2
Loc: Nottinghamshire
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


Edited by Jochen (2019-09-16 03:48 PM)
Edit Reason: Moderator added code tags

Top
#213745 - 2019-09-16 04:23 PM Re: Printing on new server [Re: GBMicros]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6376
Loc: Stuttgart, Germany
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


Edited by Jochen (2019-09-16 04:25 PM)
_________________________



Top
#213746 - 2019-09-18 11:45 PM Re: Printing on new server [Re: Jochen]
mole Online   mad
Getting the hang of it

Registered: 2003-01-01
Posts: 74
Loc: Indian Head, Maryland, USA
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.
_________________________
mole

Who is John Galt?

Top
#213747 - 2019-09-22 12:12 PM Re: Printing on new server [Re: mole]
GBMicros Offline
Just in Town

Registered: 2019-09-16
Posts: 2
Loc: Nottinghamshire
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

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 158 anonymous users online.
Newest Members
GBMicros, Jodey, Hiker, GTRoberts, KatieQuinn
17685 Registered Users

Generated in 0.03 seconds in which 0.012 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org