Page 1 of 1 1
Topic Options
#65265 - 2002-05-06 11:15 AM Problems Mandatory profile/printers
Gilbert van den Andel Offline
Lurker

Registered: 2002-05-06
Posts: 2
Loc: The Netherlands
Hi all,

I have a problem, which I hope someone could help me with. The current network consists out of MS Windows 95 & NT 4.0 clients. The servers are NT 4.0 We are using Mandatory profiles for all users, except the admins. Also all local profiles are being deleted at logoff. At this point everything works fine.

The problem has come, since we are slowly migrating to MS Windows 2000 Pro clients. Everything in the scripts works, only the part of printers doesnt work.

Part of the script:
*********************************
If @PRODUCTTYPE = "Windows 2000 Professional" ; Windows 2000
If Len("$Printer") > 0 AND @PRODUCTTYPE = "Windows 2000 Professional"
If AddPrinterConnection("$Printer") = 0
Use lpt1 /d
Use lpt1 "$Printer"
If SetDefaultPrinter("$Printer") <> 0
"." ;* bepaal de naam van de Default printer vanuit de share naam
$ShortPrinter = Substr($Printer,3,Len($Printer)-2)
$Pos = InStr("$ShortPrinter","\")
$PrinterSrv = Substr("$ShortPrinter",1,$Pos-1)
$PrinterShare = Substr("$ShortPrinter",$Pos+1,Len($ShortPrinter)-$Pos)
$Printerskey = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\$PrinterSrv\Printers"
$Index = 0
Do
$PrinterName = EnumKey("$PrintersKey",$index)
If @ERROR = 0
If ReadValue("$PrintersKey\$PrinterName","Share name") = $PrinterShare
$Reval = SetDefaultPrinter("\\$PrinterSrv\$PrinterName")
Endif
Endif
$index = $index + 1
Until Len("$PrinterName") = 0
Endif
Endif
Endif
If Len("$printer2") > 0
If AddprinterConnection("$Printer2") = 0
Use lpt2 /d
Use lpt2 "$Printer2"
Endif
Endif
EndIf
*************************************************

All help will be apriciated.

Kind Regards,
Gilbert van den Andel

Top
#65266 - 2002-05-07 12:15 AM Re: Problems Mandatory profile/printers
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
why you use lpt at all?

if you can give addprinterconnection the printer server and the printers sharename all you need is addprinterconnection call.
and to set it default it's the same format:
\\server\share

can you tell, why you use this long script instead of just two lines?

cheers,
_________________________
!

download KiXnet

Top
#65267 - 2002-05-07 12:53 AM Re: Problems Mandatory profile/printers
Gilbert van den Andel Offline
Lurker

Registered: 2002-05-06
Posts: 2
Loc: The Netherlands
Hi,

Why they use this long script I dont know. Someone else has developed it. The lpt ports are being used for some dos programs that are still in use.

Everytime I install a printer as a user, it is their and it works, but after a reboot the printer is gone again. This is due to the profile and the policy that is in affect.

The printers are installed in the current_user part of the registry. And that part is keep getting erased when they log-off.

Top
#65268 - 2002-05-23 08:40 PM Re: Problems Mandatory profile/printers
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

Try following script and return the output of file c:\kixdebug.log on
the board.
code:
                                            CLS
COLOR C+/N
AT (1,1) " "
IF RedirectOutput("c:\kixdebug.log")
ENDIF
? "-"+LCASE(@day)+" "+@date+" "+@time+"- kixtart "+@kix+"/3.04e script starting."
? "-"
? "-curdir: "+LCASE(@curdir)
? "-scriptdir: "+LCASE(@scriptdir)
IF (instr("-4.1x-","-"+substr(@kix,1,3)+"x-") <> 0)
? "-scriptname: "+LCASE(@scriptname)
ENDIF
? "-startdir: "+LCASE(@startdir)
? "-"
? "-userid: "+LCASE(@userid)+"/"+LCASE(@wuserid)
? "-user priv: "+LCASE(@priv)
IF (instr("-4.xx-","-"+substr(@kix,1,2)+"xx-") <> 0)
? "-version: inwin="+@inwin+"/dos="+@dos"/productsuite="+@productsuite+"/producttype="+@producttype"/csd="+LTRIM(RTRIM(@csd))
ELSE
? "-version: inwin="+@inwin+"/dos="+@dos
ENDIF
? "-"
?"- start-"+@time+"- @error @serror "?

?"- 1-"+@time+"- @error @serror "? IF @producttype = "Windows 2000 Professional" ; Windows 2000
?"- 2-"+@time+"- @error @serror "? IF Len("$Printer") > 0 AND @producttype = "Windows 2000 Professional"
?"- 3-"+@time+"- @error @serror "? IF AddPrinterConnection("$Printer") = 0
?"- 4-"+@time+"- @error @serror "? USE lpt1 /d
?"- 5-"+@time+"- @error @serror "? USE lpt1 "$Printer"
?"- 6-"+@time+"- @error @serror "? IF SetDefaultPrinter("$Printer") <> 0
?"- 7-"+@time+"- @error @serror "? "." ;* bepaal de naam van de Default printer vanuit de share naam
?"- 8-"+@time+"- @error @serror "? $shortprinter = Substr($printer,3,Len($printer)-2)
?"- 9-"+@time+"- @error @serror "? $pos = InStr("$ShortPrinter","\")
?"- 10-"+@time+"- @error @serror "? $printersrv = Substr("$ShortPrinter",1,$pos-1)
?"- 11-"+@time+"- @error @serror "? $printershare = Substr("$ShortPrinter",$pos+1,Len($shortprinter)-$pos)
?"- 12-"+@time+"- @error @serror "? $printerskey = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\$PrinterSrv\Printers"
?"- 13-"+@time+"- @error @serror "? $index = 0
?"- 14-"+@time+"- @error @serror "? DO
?"- 15-"+@time+"- @error @serror "? $printername = EnumKey("$PrintersKey",$index)
?"- 16-"+@time+"- @error @serror "? IF @error = 0
?"- 17-"+@time+"- @error @serror "? IF ReadValue("$PrintersKey\$PrinterName","Share name") = $printershare
?"- 18-"+@time+"- @error @serror "? $reval = SetDefaultPrinter("\\$PrinterSrv\$PrinterName")
?"- 19-"+@time+"- @error @serror "? ENDIF
?"- 20-"+@time+"- @error @serror "? ENDIF
?"- 21-"+@time+"- @error @serror "? $index = $index + 1
?"- 22-"+@time+"- @error @serror "? UNTIL Len("$PrinterName") = 0
?"- 23-"+@time+"- @error @serror "? ENDIF
?"- 24-"+@time+"- @error @serror "? ENDIF
?"- 25-"+@time+"- @error @serror "? ENDIF
?"- 26-"+@time+"- @error @serror "? IF Len("$printer2") > 0
?"- 27-"+@time+"- @error @serror "? IF AddPrinterConnection("$Printer2") = 0
?"- 28-"+@time+"- @error @serror "? USE lpt2 /d
?"- 29-"+@time+"- @error @serror "? USE lpt2 "$Printer2"
?"- 30-"+@time+"- @error @serror "? ENDIF
?"- 31-"+@time+"- @error @serror "? ENDIF
?"- 32-"+@time+"- @error @serror "? ENDIF
?"- 33-"+@time+"- @error @serror "?

?"- end-"+@time+"- @error @serror "?
? "-"
? "-"+LCASE(@day)+" "+@date+" "+@time+"- kixtart "+@kix+"/3.04e script ending."
? "-"
IF (instr("-4.1x-","-"+substr(@kix,1,3)+"x-") <> 0)
? "-"+@cpu+" ("+@mhz+" Mhz, memory "+MemorySize()+" MB)"
ENDIF

greetings.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 764 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.052 seconds in which 0.026 seconds were spent on a total of 12 queries. Zlib compression enabled.

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