#74884 - 2003-05-07 06:33 PM
Map printer script error
|
mig21
Fresh Scripter
Registered: 2000-07-13
Posts: 21
Loc: Lisbon, Portugal
|
Hello,
While trying to run this script:
code:
;************Variables **************** ; $PrinterName = "Xerox DC 2240 - COLOR" $PRServer = PTLPPD01 $PRShare = "XEROX COLOR" $PrtGroup = MIS ; ;*************************************** ; Break on DIM $x IF @INWIN=1 IF INGROUP("\\@WKSTA\Power Users") OR INGROUP("\\@WKSTA\Administrators") mapprinter($PRServer,$PrinterName) ELSE $x=MessageBox("The Network logon process has attempted to update your printers to the new print servers, however, it appears that you may not have sufficient rights to add a printer at this time. Please contact the Helpdesk for further assistance.", "Add Printer Warning!", 16) ENDIF ENDIF
;****************************************************************** ; as seen on USF section http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=12;t=000153 ;This Function maps or deletes NetworkPrinter by Groupmemberships ; if the user is member of the group, he will get mapped the networkprinter ; if the user is NOT a member of the group, he don't get the networkprinter or ; the printer is deleted on his PC ; ;Start with mapprinter(, ,,) ; ;This Function is tested on a NT4 Domain with NT4 and W2k Clients only! ;****************************************************************** function MapPrinter($PRServer, $PRShare, $PrinterName, $PrtGroup) $regkey="HKCU\Printers\Connections\,,"+$PRServer+","+$PrinterName if ingroup($PrtGroup) =1 if keyexist($regkey) ? "Drucker \\$PRServer\$PRShare bereits vorhanden" return else if addprinterconnection("\\"+$PRServer+"\"+$PRShare) =0 ? "Attach Network-Printer \\$PRServer\$PRShare" else ? "Error by connecting to \\$PRServer\$PRShare" ? @serror endif endif else if keyexist($regkey) if delprinterconnection("\\"+$PRServer+"\"+$PRShare) =0 ?" Delete NetworkPrinter \\$PRServer\$PRShare" else ?" Error by deleting \\$PRServer\$PRShare" ? @Serror endif else return endif endif ; endfunction
All I cat get on console windows is: "Script error : expected ENDFUNCTION ! endfunction"
If I try to debug, again I get the same error. I'am running W2kPro on NT4 DC.
Thx, mig21 [ 07. May 2003, 20:17: Message edited by: mig21 ]
|
|
Top
|
|
|
|
#74888 - 2003-05-07 07:25 PM
Re: Map printer script error
|
mig21
Fresh Scripter
Registered: 2000-07-13
Posts: 21
Loc: Lisbon, Portugal
|
Lonkero & SeaLeopard,
Thanks for your thoughts. I corrected the additional quote at $PrinterName" and now I'll try do discover what this means:
Script error : invalid method/function call: missing required parameter 3 ! mapprinter($PRServer,$PrinterName)
Unfortunatelly no more info on UDF topic MapPrinter from MasterOfDesaster.
Thx again for your time. mig21
|
|
Top
|
|
|
|
#74890 - 2003-05-07 07:34 PM
Re: Map printer script error
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
If you read the function you will see that it requires 4 parameters.
quote: ;$PRServer = Printserver ;$PRShare = Sharename of the Printer ;$Printername = The real Name of the Printer (not of the PrinterDriver!) ;$PrtGroup = The Group in the Domain where the user must belong to, to get the printer
none of which are listed as optional.
|
|
Top
|
|
|
|
#74891 - 2003-05-07 08:21 PM
Re: Map printer script error
|
mig21
Fresh Scripter
Registered: 2000-07-13
Posts: 21
Loc: Lisbon, Portugal
|
Howard,
I dont't get it... I've declared the 4 parameters. What can the script be expecting?
mig21
|
|
Top
|
|
|
|
#74893 - 2003-05-07 08:26 PM
Re: Map printer script error
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
This was the function call you previously posted. code:
mapprinter($PRServer,$PrinterName)
This shows 2 parameters. What is your current code?
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|