Solved

Enable Advanced Printing Features

Posted on 2012-04-01
6
1,234 Views
Last Modified: 2012-04-02
When I run that scripts it pops (check attachment)..All I want is to enable or disable the feature on a chosen printer on teh printer server.

'To Enable Advanced Printing Features
'RUNDLL32 PRINTUI.DLL,PrintUIEntry /Xs /n "printer name" attributes -RawOnly

'To Disable Advanced Printing Features
'UNDLL32 PRINTUI.DLL,PrintUIEntry /Xs /n "printer name" attributes +RawOnly


Const ForReading = 1
dim printer
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\printers.txt", ForReading)
Set objShell = CreateObject("Wscript.Shell")
Do while not objFile.AtEndOfStream
    Printer = objFile.ReadLine
    Printer = "\\???\U150C1-Costar"
    Wscript.echo printer
    strCmd = "rundll32 printui.dll,PrintUIEntry /xs /n " &  printer & " attributes +RawOnly"
    objShell.Run StrCmd
Loop
objFile.Close
0
Comment
Question by:Bianchi928
  • 3
  • 3
6 Comments
 
LVL 65

Expert Comment

by:RobSampson
ID: 37794734
Hi, I can't see the attachment...
0
 

Author Comment

by:Bianchi928
ID: 37795434
oops sorry. Like you'll it's looking at the printer server properties instead. ALl I want is to be able /disable the "Advanced Printing Features"
screen.JPG
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 37799316
Hi, I think the only problem was that you need a capital X following by a lower case s but I have also put quotes around the printer name, just in case.

    strCmd = "rundll32 printui.dll,PrintUIEntry /Xs /n """ &  printer & """ attributes +RawOnly

Regards,

Rob.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:Bianchi928
ID: 37799401
I've got an Unterminated string constant on Line 16

'To Enable Advanced Printing Features
'RUNDLL32 PRINTUI.DLL,PrintUIEntry /Xs /n "printer name" attributes -RawOnly

'To Disable Advanced Printing Features
'RUNDLL32 PRINTUI.DLL,PrintUIEntry /Xs /n "printer name" attributes +RawOnly


Const ForReading = 1
dim printer
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\documents and settings\cis0794\desktop\printers.dat", ForReading)
Set objShell = CreateObject("Wscript.Shell")
Do while not objFile.AtEndOfStream
    Printer = "Lexmark T654 PS3"
'   Printer = objFile.ReadLine
    strCmd = "rundll32 printui.dll,PrintUIEntry /Xs /n """ &  printer & """ attributes +RawOnly

    objShell.Run StrCmd
Loop
objFile.Close
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 200 total points
ID: 37799416
Oops, sorry. I forgot to add the closing quote.

    strCmd = "rundll32 printui.dll,PrintUIEntry /Xs /n """ &  printer & """ attributes +RawOnly"

Rob.
0
 

Author Closing Comment

by:Bianchi928
ID: 37799437
Perfect
Thanks mate
Cheers
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Recently I finished a vbscript that I thought I'd share.  It uses a text file with a list of server names to loop through and get various status reports, then writes them all into an Excel file.  Originally it was put together for our Altiris server…
This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now