Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


SepticSceptic

2150 posts

Uber Geek

Trusted

#66449 19-Aug-2010 10:58
Send private message

I'm having a hell of a job getting a script to run under Server 2008 R2. It's simple enough, works under all other recent versions of MS Windows - XP, Server 2003, Win 7, Server 2008.

It started off with a cmd line PRINTUI entry to capture default settings of printers, viz:

RUNDLL32 PRINTUI.DLL,PrintUIEntry /Ss /n <printer> /a c:\printer.bin

then to restore:


RUNDLL32 PRINTUI.DLL,PrintUIEntry /Sr /n <printer> /a c:\printer.bin g d u

where <printer> is the name of the printer

These 2 command line functions work well in all recent versions of MS Windows, except Server 2008 R2. On Server 2008 R2, I get an error code 0000000c. Tested on two different installations of Server 2008 R2, so it's not just my setup.

A look into technet mentioned that any cmd line functions should now be scripted. Being a complete noob @ scripting, a colleague wrote a Q&D script:

set wshell = CreateObject("WScript.Shell")
    wshell.run "RUNDLL32 PRINTUI.DLL,PrintUIEntry /Sr /n PRINTER /a c:\printer.bin g d u", 0, TRUE
    set wshell = nothing

msgbox "OK"

Again, this script does not work on Server 2008 R2, not even the expected OK dialog box. No error codes, nada. Script works OK on any previous Windows versions.

What the heck am I doing wrong ?





Create new topic
SepticSceptic

2150 posts

Uber Geek

Trusted

  #369773 19-Aug-2010 12:46
Send private message

More playing around:
On Server 2008 R2, I can use the command line:
RUNDLL32 PRINTUI.DLL,PrintUIEntry /Ss /n /a c:\printer.bin
to create the restore file, printer.bin. Works.

Copied this printer.bin file to Server 2008 (STD), and ran the restore command from the cmd prompt:
RUNDLL32 PRINTUI.DLL,PrintUIEntry /Sr /n /a c:\printer.bin g d u

Printer settings restored. So the restore file is not corrupt, and can be created from the command line on Server 2008 R2.

So it's ony on Server2008 R2 that this restore command is not working - I'm beginning to think this is some kind of permissions thing ?

 
 
 

GoodSync. Easily back up and sync your files with GoodSync. Simple and secure file backup and synchronisation software will ensure that your files are never lost (affiliate link).
buzzy
217 posts

Master Geek


  #369804 19-Aug-2010 14:08
Send private message

Error 0x0000000c translates as "The access code is invalid" - not much help really, but it suggests it may not be an explicit permissions issue, or you'd have got 0x00000005.

When they say this sort of stuff should be scripted, they're talking about using VBscript or Jscript to access a COM object to perform the actions. Having a script fire off a command via WshShell.Run isn't any different to running it yourself from the command prompt.

There are plenty of VBscript code fragments on the net; you may be able to find one to use without first having to learn too much scripting.

Create new topic





News and reviews »

Samsung 9100 Pro NVMe SSD Review
Posted 11-Apr-2025 13:11


Motorola Announces New Mid-tier Phones moto g05 and g15
Posted 4-Apr-2025 00:00


SoftMaker Releases Free PDF editor FreePDF 2025
Posted 3-Apr-2025 15:26


Moto G85 5G Review
Posted 30-Mar-2025 11:53


Ring Launches New AI-Powered Smart Video Search
Posted 27-Mar-2025 16:30


OPPO RENO13 Series Launches in New Zealand
Posted 27-Mar-2025 05:00


Sony Electronics Announces the WF-C710N Truly Wireless Noise Cancelling Earbuds
Posted 26-Mar-2025 20:37


New Harman Kardon Portable Home Speakers Bring Performance and Looks Together
Posted 26-Mar-2025 20:30


Data Insight Launches The Data Academy
Posted 26-Mar-2025 20:21


Oclean AirPump A10 Portable Water Flosser Wins iF Design Award 2025
Posted 20-Mar-2025 12:05


OPPO Find X8 Pro Review
Posted 14-Mar-2025 14:59


Samsung Galaxy Ring Now Available in New Zealand
Posted 14-Mar-2025 13:52


2degrees Announces Partnership With AST SpaceMobile and Plans for NZ Launch
Posted 11-Mar-2025 10:05


Samsung Introduces New Galaxy A56 5G, Galaxy A36 5G and Galaxy A26 5G
Posted 9-Mar-2025 12:18


Cricut Unveils the Next Generation of Smart Cutting Machines
Posted 9-Mar-2025 12:06









Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.