Printer Orientation

Posted on 2012-03-26
Last Modified: 2012-03-28
I want to change a list fo printers from Portrait to Landscape...I have this code

I need some help here

strComputer = "????"
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colInstalledPrinters =  objWMIService.ExecQuery("SELECT * FROM Win32_PrinterConfiguration where name like '%u104c2%")


For Each objPrinter in colInstalledPrinters
      wscript.echo ObjPrinter.Orientation
      ObjPrinter.Orientation =

Wscript.echo "Done"
Question by:Bianchi928
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
  • 2
  • 2
LVL 75

Expert Comment

by:Michel Plungjan
ID: 37772437

Author Comment

ID: 37773614
I've seen that link prior to my question. If I set ObjPrinter.Orientation = 2 and then check what the result still shows protrait..That's what I don't understand

LVL 75

Expert Comment

by:Michel Plungjan
ID: 37775109
sorry. then I do not have any suggestions
LVL 20

Accepted Solution

ltlbearand3 earned 200 total points
ID: 37780064
The WMI Printer collection is mostly read only including the Orientation.  This value cannot be set with the Put command.  If this is all being run on one machine, you could install setprinter and use it to change the orientation.  (Download and install the Windows 2003 Resource kit from and install the kit.  This will put setprinter on your machine.)  Then you could run a script like this:

strComputer = "."
Set objShell = CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colInstalledPrinters =  objWMIService.ExecQuery("SELECT * FROM Win32_PrinterConfiguration where name like '%u104c2%'")

For Each objPrinter in colInstalledPrinters
	objShell.Run ("setprinter.exe """ & objPrinter.Name & """ 2 ""pDevMode=dmOrientation=2""")	

Wscript.echo "Done"

Open in new window


Author Closing Comment

ID: 37780083
That's all I wanted. You'ev got the points


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This script will sweep a range of IP addresses (class c only, and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

635 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