Solved

get printer list script

Posted on 2013-11-12
7
566 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
  • 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

First some basics on Windows 7 Backup.  It has 2 components one is a file based backup which is stored in .zip files each zip is split at around 200 Megabytes and there is the Image Backup which is as the name implies a total image of the partition …
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

830 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