Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

get printer list script

Posted on 2013-11-12
7
Medium Priority
?
577 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 36

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 36

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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 36

Accepted Solution

by:
Kimputer earned 2000 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

Enroll in October's Free Course of the Month

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!

Question has a verified solution.

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

By default the complete memory dump option is disabled in windows . If we want to enable the complete memory dump for a diagnostic purpose, we have a solution for it. here we are using the registry method to enable this.
There are many software programs on offer that will claim to magically speed up your computer. The best advice I can give you is to avoid them like the plague, because they will often cause far more problems than they solve. Try some of these "do it…
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
Suggested Courses

604 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