Home All Groups Group Topic Archive Search About

AddWindowsPrinterConnection: Persistent Connections?



Author
26 Oct 2007 10:27 PM
rmfisher
I have looked everywhere, including MSDN, and nowhere can I find how
to make printers that are connected through the
AddWindowsPrinterConnection method connect WITHOUT a persistent
connection.  Is this possible?  I tried putting "False" after the line
like

objNetwork.AddWindowsPrinterConnection "\
\vPrint01\8AcctAdmin","False"

but that didn't work.  I know there is AddPrinterConnection, but that
has to map to LPTx and I don't want that, plus although I don't have
it here, I am mapping multiple printers to each group.  Any ideas are
very much appreciated!  Thanks!

Here is a sample of my script:

Set objNetwork = CreateObject("Wscript.Network")


' Retrieve computer Distinguished Names.
Set objSysInfo = CreateObject("ADSystemInfo")
strComputerDN = objSysInfo.computerName

' Bind to the computer object.
Set objComputer = GetObject("LDAP://" & strComputerDN)

' Enumerate groups computer is a member of.
For Each objGroup In objComputer.Groups
' Retrieve NT name of group. Make lower case.
strGroupName = LCase(objGroup.sAMAccountName)
Select Case strGroupName
Case "8th floor printers"
objNetwork.AddWindowsPrinterConnection "\\vPrint01\8AcctAdmin"
Exit For
Case "10th floor printers"
objNetwork.AddWindowsPrinterConnection "\\vPrint01\10Facilities"
Exit For
Case "14th floor printers"
objNetwork.AddWindowsPrinterConnection "\\vPrint01\14Color"
Exit For
Case "17th floor printers"
objNetwork.AddWindowsPrinterConnection "\\vPrint01\17Color"
Exit For
Case "19th floor printers"
objNetwork.AddWindowsPrinterConnection "\\vPrint01\19EM"
Exit For
Case "20th floor printers"
objNetwork.AddWindowsPrinterConnection "\\vPrint01\20EM"
Exit For
Case "21st floor printers"
objNetwork.AddWindowsPrinterConnection "\\vPrint01\21ECopyRmMFP"
Exit For
Case "22nd floor printers"
objNetwork.AddWindowsPrinterConnection "\\vPrint01\22ECopyRm"
Exit For
Case "23rd floor printers"
objNetwork.AddWindowsPrinterConnection "\\vPrint01\23Color"
Exit For
Case "24th floor printers"
objNetwork.AddWindowsPrinterConnection "\\vPrint01\24EN"
Exit For
End Select
Next

AddThis Social Bookmark Button