Solved

Enable Advanced Printing Features

Posted on 2012-04-01
6
1,280 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

This is an addendum to the following article: Acitve Directory based Outlook Signature (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24950055.html) The script is fine, and works in normal client-server domains…
In this article we want to have a look at the directory attributes which are used by Microsoft to store the so called Security Identifiers (SID). These SIDs plays an important role in delegating and granting permissions and in authentication of trus…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

770 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