Hi Allan

(note: PrinterList() and PriMapState() have been sourced from the Kix UDF library)

You are correct.

Our network users typically don't have have much more than Domain User access. When they login we want the script to interrogate the users print server (a remote pc) and then add those printers to their desktop config.

This is another piece of code that I have found on the BBS

for each $share in listPrinterShares($computer)
$share ?
next

function listPrinterShares(optional $computer)
dim $share,$shares,$a[0]
$a[0] = "PrintQueue"
if not vartype($computer) $computer=@wksta endif
$computer = getobject("WinNT://"+$computer+",Computer")
$computer.filter=$a
if @error exit @error endif
for each $share in $computer
redim preserve $shares[ubound($shares)+1]
$shares[ubound($shares)] = $share.name
next
$listPrinterShares = $shares
endfunction

This gets the list of printer shares without having the security issue however it returns the share name of the printer. When the share name of the printer is passed to PriMapState() it can return null if the printer name and the printer share name are not the same. My script will try to add the printer again. Eg the share name for a printer is \\PSAUMEL1\Xerox84000 but its printer name is \\PSAUMEL1\Xerox Phaser 8400DP

For this reason PrinterList() is nicer.

Can PrinterList() be updated so that it can work where $remotepc is a print server on a network and the calling user has limited network priviledges ?
For my purposes the solution can involve the creation of a dedicated account on the print server to perform winmgmts: call.

The functional part of my code is

? 'Getting the list of printers from print server: ' + $remotepc
$array=printerlist($remotepc)

for each $printer in $array

$printer = '\\' + $remotepc + '\' + $printer
$x = PriMapState($printer)

if $x = ""
? 'Adding printer: ' + $printer
addprinterconnection ($printer)
endif

next

Regards Mark