Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!
' List All Published Printers ' Windows Server 2003 : Yes ' Windows XP : Yes ' Windows 2000 : Yes ' Windows NT 4.0 : Yes ' Windows 98 : Yes Const ADS_SCOPE_SUBTREE = 2 Set objConnection = CreateObject("ADODB.Connection") Set objCommand = CreateObject("ADODB.Command") objConnection.Provider = "ADsDSOObject" objConnection.Open "Active Directory Provider" Set objCommand.ActiveConnection = objConnection objCommand.CommandText = "Select printerName, serverName from " _ & " 'LDAP://DC=fabrikam,DC=com' where objectClass='printQueue'" objCommand.Properties("Page Size") = 1000 objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE Set objRecordSet = objCommand.Execute objRecordSet.MoveFirst Do Until objRecordSet.EOF Wscript.Echo "Printer Name: " & objRecordSet.Fields("printerName").Value Wscript.Echo "Server Name: " & objRecordSet.Fields("serverName").Value objRecordSet.MoveNext Loop
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.