CSV Format:
Printserver,drivername,PortName,IPAddress,Sharename,Location,Comment,Printername
XXX,HP Test,IP_x.x.x.x,x.x.x.x,printername,location test,comment test,printernameScript:
function CreatePrinter {
$server = $args[0]
$print.drivername = $args[1]
$print.PortName = $args[2]
$print.Shared = $true
$print.Sharename = $args[3]
$print.Location = $args[4]
$print.Comment = $args[5]
$print.DeviceID = $args[6]
$print.Put()
}
function CreatePrinterPort {
$server = $args[0]
$port.Name= $args[1]
$port.SNMPEnabled=$false
$port.Protocol=1
$port.HostAddress= $args[2]
$port.Put()
}
$printers = Import-Csv c:\printers.csv
foreach ($printer in $printers) {
CreatePrinterPort $printer.Printserver $printer.Portname
$printer.IPAddress
CreatePrinter $printer.Printserver $printer.drivername
$printer.Portname $printer.Sharename $printer.Location $printer.Comment
$printer.Printername
}