and like I said before, you should really look into faq forum topic:
How to use UDFs

just like I said in the first reply, your call is wrong.

and like I said in the second reply, you are better out with inbuild function:
AddPrinterConnection( ) Add a connection to a network printer (NT family only)

but your ingroup conditions are not needed at all.

so your full script you posted can be replaced with simple:
code:
$returncode=addprinterconnection("\\PTLPPD01\XEROX COLOR")

_________________________
!

download KiXnet