Solved

Printer VBScript Reversal

Posted on 2011-03-23
25
320 Views
Last Modified: 2012-05-11
Our server is currently having an issue where it is trying to run a printer script and keeps gettinga SQL dialog box. We need to know how to reverse this script so it stops occuring. Your help is very important right now.

Thanks,

Nathan
0
Comment
Question by:murphyins
  • 13
  • 5
  • 2
  • +1
25 Comments
 

Author Comment

by:murphyins
ID: 35202156
In addition, we have a script that we normally use to remove all the printers that are on the script. When I try to run that script, I get this error where is says Line: 7, Char: 1, Error: 0x80041017, Code: 80041017, and Source: (null)
0
 

Author Comment

by:murphyins
ID: 35202197
One more thing. The remove script works on all of our computers just not this server.
0
 

Author Comment

by:murphyins
ID: 35202212
Here's the script

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colInstalledPrinters =  objWMIService.ExecQuery _
    ("Select * from Win32_Printer Where Network = TRUE")

For Each objPrinter in colInstalledPrinters
    objPrinter.Delete_
Next
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 35207548
<<The remove script works on all of our computers just not this server. >>
Does your server have a printer attached to it?  The only pre-requisite is that you have a printer attached to the machine where you run the script.  Be aware, there may be a delay while the script checks all possible printer ports.

see this link for example wmi scripts:
          http://www.computerperformance.co.uk/vbscript/wmi_printer.htm
0
 

Author Comment

by:murphyins
ID: 35209399
The printers are networked. When we orginally ran the script to add the printers, a SQL dialog box appeared and I will have to look at the error again.
0
 

Author Comment

by:murphyins
ID: 35210165
Ok I have the SQL dialog box. It says across the top: Microsoft SQL Server Desktop Engine.
First Description: The feature you are trying to use is on a network resource that is unavailable.
Second Description: Click Ok to try again, or enter an alternate path to a folder containing the installation package 'SqlRun01.msi' in the box below
0
 

Expert Comment

by:Dave2120
ID: 35210247
Not sure if this will help but are the computers you are trying to remove connected to a computer/server that is not turned on when you try to run the script? I have created drive mapping scripts in the past and they do not like it when they can't talk to networked printer.
0
 

Expert Comment

by:Dave2120
ID: 35210274
Sorry; printers you are trying to remove.
0
 

Author Comment

by:murphyins
ID: 35210310
They are connected to our servers which they are all on. This problem has been going on for a few weeks now. When I run the script I get that sql dialog box and when I run the removal, I get that error listed a few comments above.
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 35210540
Per my original response, the reference source says "the only pre-requisite is that you have a printer attached to the machine where you run the script.  Be aware, there may be a delay while the script checks all possible printer ports."

I interpret that to mean the machine on which you are running the script must be physically connected to a printer.  

0
 

Author Comment

by:murphyins
ID: 35210592
It isn't physically attached to the printer and neither is any of our other computers. This server is the only one that is having this issue. What I really want is for that dialog box to go away.
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:murphyins
ID: 35507738
It don't really want it closed because the problem hasn't been resolved yet. I would just end up posting the same question again anyways.
0
 

Author Comment

by:murphyins
ID: 35517143
I don't want it closed, read comment above
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 35517839
Hi there,

This seems more or less related to the printer drivers that you might have installed:

http://social.msdn.microsoft.com/forums/en-US/sqldatabaseengine/thread/cc55c10b-d0e1-426b-b4dd-b2f305110fc6

Do you get the same message when you just open the Printers and Faxes control panel?  Or when you print from Word?

One probable fix is to upgrade the server driver to PostScript.....

On the other hand, if you don't care about the error, just add
On Error Resume Next
to the top of the script.

Regards,

Rob.
0
 

Author Comment

by:murphyins
ID: 35780795
Yes I do get this message when I open the Printers and Faxes in the control panel.
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
ID: 35782767
So you will have a driver problem then, most likely.

You will need to see if it is fixed by removing any problem drivers.

On the machine, logged in as Admin, delete all printer objects that you need to, then restart the Print Spooler service.  Right click in the Printers and Faxes dialog, and select Server Properties.  Go to the Drivers tab, and remove the problematic ones.  You may need to restart the print spooler service a few times in between.  Then reboot, and see if you can install the printer normally.

Regards,

Rob.
0
 

Author Comment

by:murphyins
ID: 35789548
I did all of that. I am just waiting for an chance to reboot the server.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 35790464
Sure. Let me know.  You might want to check any clients that have the same problem too.

Rob.
0
 

Author Comment

by:murphyins
ID: 35817691
All is well again, however, everytime I want to add the printer manually, it comes back so I have to delete it again to make the SQL dialog go away. I'm not sure what else I should try to get this printer installed on the server.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 35837330
Do you know which printer driver (and model) actually causes the problem?
0
 

Author Comment

by:murphyins
ID: 35890719
I've found this to happen to no matter which printer I add. I just want the HP 2300 added.
0
 
LVL 65

Assisted Solution

by:RobSampson
RobSampson earned 500 total points
ID: 35912363
If you have the MSDE installed, you may need to look here:
http://support.microsoft.com/kb/311762

to find out where the installation source originally came from.  Then you might be able to point the dialog to that location when it prompts you for SQLRun01.msi, and it should complete the install.

If you do not have MSDE installed, you may need to run the Windows Installer Cleanup Utility.

Regards,

Rob.
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.

Join & Write a Comment

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

746 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

13 Experts available now in Live!

Get 1:1 Help Now