Deleting printer from P&F without printer on network
Windows Server Forum Index Windows Server
Server discussion on Windows platform.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web winserverhelp.com
Deleting printer from P&F without printer on network

 
Post new topic   Reply to topic    Windows Server Forum Index -> Programming
Author Message
Ed Panzeter
Guest





Posted: Wed Jan 05, 2005 3:33 am    Post subject: Deleting printer from P&F without printer on network Reply with quote

I am trying to delete a printer from our network but have run into some
issues. The printer DeviceID/Name is "\\fiery e650\print" and was set up
before I worked here. We returned the printer about a week ago off of the
lease and I can't get it to delete. I am using the following script:

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

Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer where DeviceID = '\\fiery e650\print'")

For Each objPrinter in colInstalledPrinters
objPrinter.Delete_
Next


When run using cscript, I get the following error message:

c:\FieryUninstall.vbs(8, 1) (null): 0x80041017


Any idea what it could be? I am at a complete loss for a solution and need
some guidance. As I stated the printer is gone (as well as the integrated
print server it had with it). Am I going to have to manually delete this
printer from ~100 computers?
Back to top
SubnetJO
Guest





Posted: Wed Jan 05, 2005 4:45 am    Post subject: RE: Deleting printer from P&F without printer on network Reply with quote

Quote:
print server it had with it). Am I going to have to manually delete this
printer from ~100 computers?

Yes... I'm afraid.
I suppose you have checked the DeviceID of the printer.
The error means that no item was selected by your query, against the cimv2
database.
So, no printer with deviceid "\\fiery e650\print" was found.

Try this:
1]
Run this script (cscript better) on a client of yours, logged on WITH END
USER CREDENTIALS.
----------------------------------------
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery ("Select * from
Win32_Printer")
For Each objPrinter in colInstalledPrinters
wscript.echo "DeviceID = " & objprinter.deviceid
Next
----------------------------------------------

If your printer is listed, check the deviceID you use in your script.
Must be the same.
Take care about the case of the letters!

2]
If you printer is not listed at all, always with the end user credentials,
try to connect the printer with the script below:
-------------------------------------
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\\ServerName\PrinterShareName"
-------------------------------------

If the connection works, I hope it will "overwrite" the existing one.
Now you'll surely find you printer listed by the script shown in the step
"1]" and you can delete it with your script.

There could be other reasons regarding the coomputer configuration, because
your script doesn't work, but I cannot know the enviroment...


I hope this can help.
Bye,
SubnetJO
Italy
Back to top
 
Post new topic   Reply to topic    Windows Server Forum Index -> Programming All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




New Topics Powered by phpBB