Solved

get printer list script

Posted on 2013-11-12
7
569 Views
Last Modified: 2013-11-18
I found the following script on the scripting guys website. I did NOT create this script - and I say that so emphatically because I know NOTHING about scripting.
Having said that, the script runs fine, except for remote computers on my network. For remote computers it only shows those "virtual" printers like Microsoft XPS document writer.
The way the network printers are installed they show up as
Printername on Printservername
and I don't know if that is an issue - also on the website it said something about 64bit computers - my computer is 64bit, but all the other computers on the network are 32bit.
So is there a way to adjust this script to show the network printers? Those are the only ones I'm conscerned about - I don't care about the "virtual" printers.

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colPrinters = objWMIService.ExecQuery("Select * From Win32_Printer")
     
For Each objPrinter in colPrinters
    If objPrinter.Attributes And 64 Then
        strPrinterType = "Local"
    Else
        strPrinterType = "Network"
    End If
    Wscript.Echo objPrinter.Name & " -- " & strPrinterType
Next
0
Comment
Question by:JeffBeall
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 35

Expert Comment

by:Kimputer
ID: 39641888
So you mean, you checked the computer not showing the printers in the script, but you checked through the computer > start > printers and faxes, and they're really there ?

How do you run the script anyway? You are physically at the computer to run the script?

Tested on 32bit XP Pro btw, and it's working as it should
0
 
LVL 1

Author Comment

by:JeffBeall
ID: 39642328
"but you checked through the computer > start > printers and faxes, and they're really there ?"

yes, the printers are there.

"How do you run the script anyway? You are physically at the computer to run the script?"

you don't have to be at the computer - from my laptop connected to the network - i change the variable

"strComputer = "

to whatever comptuer name I need and save the change, then simply run the script

"Tested on 32bit XP Pro btw, and it's working as it should"

I am running on win7 - would there need to be a change for that?
0
 
LVL 35

Expert Comment

by:Kimputer
ID: 39644216
So, just to be thorough, can you really go sit behind a computer and run the script?
Using a script from remote could mean different credentials, meaning different results from what you'd expect. Network printers are stored in the user space.
0
What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

 
LVL 1

Author Comment

by:JeffBeall
ID: 39651606
hello?
0
 
LVL 1

Author Comment

by:JeffBeall
ID: 39651614
sorry, I kept trying to post a comment and it wasn't working
so anyway
yes, I can run the script at the computer and it works, but that is not what i want to do.
so i was wondering if there is something wrong with the syntax, or if i could add a line to make it work with network printers.
0
 
LVL 35

Accepted Solution

by:
Kimputer earned 500 total points
ID: 39653392
Have it run under the user (when he logs in, so do it through a group policy that runs after log in, because if you put it at computer start, it's still the system account), and report the output back in another way (email or file on the network).
0
 
LVL 1

Author Closing Comment

by:JeffBeall
ID: 39656872
thank you
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
On some Windows 7 (SP1) computers, Windows Update becomes super slow even the computer is reasonably fast.  There's one solution that seemed to have worked well for me (after trying a few other suggested solutions).
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question