Publishing Printers to a Load Balance Alias

G

Goose

I have two Dell servers setup with Microsoft load balancing (MLB) as
print servers. When the printers publish to Active Directory they
publish from each server, I want them published and be assigned to
the printer alias between the servers and not the servers them
selves.. Has anyone done this and had it work?

Bob
 
G

Guest

Hi Goose and everybody,
I have the same problem and I wrote a script who works fine, you muste create a computer account for your virtual server (name of your cluster server or alias)


Option Explicit



Dim objWMIService
Dim ServerName, NLBSName, Container, ServerShortName
Dim PQContainer
Dim PrinterShareName, PrinterPortName, PrinterDriverName, PrinterDescription, PrinterLocation
Dim colInstalledPrinters, objPrinter
Dim objParent
Dim cn


ServerName= "one server in cluster"
NLBSName = "clustername of your server"
Container = "LDAP://CN=clustername of your server,OU=Serveurs Impression,OU=1-Serveurs,DC=domainname,DC=com"
ServerShortName = "name of your clusterserver without name of domain"


Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & ServerName & "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery ("Select * from Win32_Printer")

For Each objPrinter in colInstalledPrinters

PrinterShareName = objPrinter.ShareName
PrinterPortName = objPrinter.PortName
PrinterDriverName = objPrinter.DriverName
PrinterLocation = objPrinter.Location
PrinterDescription = objPrinter.Comment

Wscript.Echo "ShareName: " & PrinterShareName
Wscript.Echo "PortName: " & PrinterPortName
Wscript.Echo "DriverName: " & PrinterDriverName
Wscript.Echo "Location: " & PrinterLocation
Wscript.Echo "Description: " & PrinterDescription

Call PublishPrinter("\\" & NLBSName & "\" & PrinterShareName, Container)
Next





Sub PublishPrinter (UNC, Container)


set objParent = GetObject("LDAP://CN=clustername of your server,OU=Serveurs Impression,OU=1-Serveurs,DC=domainname,DC=com")
set objPrinter = objParent.Create("printQueue", "cn=" & ServerShortName & "-" & PrinterShareName)

objPrinter.Put "name", ServerShortName & "-" & PrinterShareName

objPrinter.Put "printerName", PrinterShareName

objPrinter.Put "uNCName", UNC

objPrinter.Put "instanceType", "4"

objPrinter.Put "serverName", NLBSName

objPrinter.Put "portName", PrinterPortName

objPrinter.Put "driverName", PrinterDriverName

objPrinter.Put "shortServerName", ServerShortName

objPrinter.Put "versionNumber", "4"

On Error Resume Next
objPrinter.Put "Location", PrinterLocation
On Error Resume Next
objPrinter.Put "description", PrinterDescription


On Error Resume Next
objPrinter.SetInfo
ERR.Clear


End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top