remotely delete windows 98 printers


I was wondering if anyone knows of a way to remotely delete printers in windows 98?
I need to do this with a large number of machines, and hope to do it by scripting eg in a login script or some scripting language, rather than manual labour.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Greetings, sbradley2002!
   Where you looking for a program like PC Anywhere?

Best wishes, war1
   Here is a free remote desktop Tridia VNC
sbradley2002Author Commented:
I already have vnc on the network.
This approach would still take considerable labour, someone sitting at a desk for hours on end.
I was looking for a scripted, behind-the-scenes, as the user logs on approach.
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

I think there would be a possibility of editing the registry, but are you trying to remove the SAME printer applet from ALL computers, or will you be removing other ones as well.

Doing a brief search in my registry using the exact name used by the applet in Control Panel > Printers > Epson Stylus COLOR 760, reveals the most obvious key:


the "Default" StringValue has the DataValue "Epson Stylus COLOR 760"

This key also has a sub-key named "Epson Stylus COLOR 760" with the "Default" value set to [value not set].

There are as many named folders here as there are printers in the Control Panel > Printers folder, so I would hazard a guess that by resetting the "Default" value to another printer name and leaving that sub-key intact, and by deleting the sub-key for the printer you want to remove, then this might remove the item from the "Printers" folder and set the other one as the default printer which will then be recognised by different applications needing a default printer.

I assume that you could call a .REG file from autoexec.bat or from the server to make the changes, but I think you would have to first copy some details from your system's registry to verify the details.

For instance, there is also the following registry key on my PC with details of this printer:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print\Printers\EPSON Stylus COLOR 760

I will create a phantom printer on my Windows 98 machine and see if, by deleting the relevant registry key, the printer can be removed and another printer set as the default.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sbradley2002Author Commented:
I will be trying to remove the same printer applet from all computers (if that printer exists on that computer of course)
The logic would be something like
If printer "printername" exists
     remove printer
Have you run your test yet?
sbradley2002Author Commented:
I ended up created my own inf file, and running it in the login script that everyone had.
Look at ms kb article 171424 and in msdn for instructions on how to do this.
Deleting the registry keys was not enough in windows 98, had to also removed lines from the win.ini to get rid of the printer.
That's all I did.
If I wanted to do this properly I should also track down the files used by each printer, and use the inf file to remove them as well.  The file below deletes 2 printers every time it is run in the login script.  For other printers there may be way more registry entries or win.ini lines to remove.
I run the inf file using this line in the logon scripts -
rundll setupx.dll,InstallHinfSection RunIt 0 \\srvr\share\delprn.inf

Here is the inf file I use...
; This file called  Delprn.INF deletes the printers
; under the [RegChange] section.  This one deletes entries representing defunct printers
; also erases win.ini entries in the EraseWinINIEntry's representing defunct printers


DelReg = RegChange
UpdateInis = EraseWinINIEntrys

DelReg = RegChange
UpdateInis = EraseWinINIEntrys

;HKU is short for HKEY_USERS

HKCU,Software\Microsoft\Windows\CurrentVersion\Explorer\Printers,"Admin Gnd Flr HP DJ 540"
HKLM,Config\0001\System\CurrentControlSet\Control\Print\Printers\"Admin Gnd Flr HP DJ 540"
HKLM,System\CurrentControlSet\Control\Print\Printers\"Admin Gnd Flr HP DJ 540"
HKLM,System\CurrentControlSet\Control\Print\Environments\"Windows 4.0"\Drivers\"Admin Gnd Flr HP DJ 540"
HKCU,Software\Microsoft\Windows\CurrentVersion\Explorer\Printers,"Finance OKI Microline 591"
HKLM,Config\0001\System\CurrentControlSet\Control\Print\Printers\"Finance OKI Microline 591"
HKLM,System\CurrentControlSet\Control\Print\Printers\"Finance OKI Microline 591"

c:\windows\win.ini, Devices, "Admin Gnd Flr HP DJ 540=*",
c:\windows\win.ini, PrinterPorts, "Admin Gnd Flr HP DJ 540=*",
c:\windows\win.ini, Ports, "\\srvr\AdminGndFlrHPDJ540=*",
c:\windows\win.ini, Devices, "Finance OKI Microline 591=*",
c:\windows\win.ini, PrinterPorts, "Finance OKI Microline 591=*",
c:\windows\win.ini, Ports, "\\srvr\AdminGndFlrOKIMicroline591=*",

My god, that was quick Shaun, I've just started to create a hypothetical batch file to do the job.  I feel kind of guilty that you've actually solved this one yourself. I work nights and just got up a while ago, you see.

What I intended doing was to first call the printer software uninstall files from the command line if they existed, allow them to run, force a reboot, and then cleanup and reset registry entries if they existed by calling the batch file again.

I recalled seeing a programme which would automate much of the work, but had to find the url again. There's a version for Windows 98 as well.
Multi Remote Registry Changer  (MRRC)

It's not as easy using the command line to delete registry entries in 98 as with NT which has its own tools such as REG.EXE, REGCHG.EXE, REGFIND.EXE, REGINI.EXE, REGDMP.EXE etc from the resource kit supplement.

I remembered seeing a Visual Basic/Windows Scripting code to do the job and managed to find it again (must remember to bookmark these things in future). It might be of assistance to you at some point in the future:

Their explanation:

As it is not possible to delete keys or values using .REG files, this is a small vbs program that deletes keys or values from the registry.

[path] RegDelete [Key] | [Value]

'Deletes keys or values from the registry.
'Serenity Macros
'David Candy
On Error Resume Next
vbPara=vbCRLF & vbCRLF
strExplain="RegDelete deletes keys and values from the registry." & vbPara & "Keys must end with a backspace and values must not." & vbPara & "Start without parameters to type in a key or value to delete, or place the key or value on the command line (use inverted commas to surround the key or value if it contains spaces)."  & vbPara & "Continue"
strTitle="Reg Delete"
Dim silent

Dim Sh
Set Sh = WScript.CreateObject("WScript.Shell")
ReportErrors "Creating Shell"

If Key<>"" then
      B=Sh.RegRead (Key)
      If Err.Number=0 Then
            Sh.RegDelete Key
            If Err.Number =0 Then
                  If silent<>"yes" Then MsgBox Key & " deleted", vbOKOnly + vbInformation, strTitle
                  ReportErrors "DeletingKey"
            End If
            If Err.Number=-2147024893 then
                  MsgBox Key & " didn't exist", vbOKOnly + vbCritical, strTitle
                  ReportErrors "Reading before Deleting Key"
            End If
      End If
End If

ReportErrors "Main"

Function GetKey()
      Dim Ag
      Set Ag=Wscript.Arguments
      ReportErrors "Creating Aguments"
      If Ag.Count=1 then GetKey=Ag(0)
      If Ag.Count >1 then sgBox "Too many parameters on command line. Try enclosing the key in a space",vbOKOnly + vbCritical, strTitle

      If Ag.Count=0 then
            If MsgBox (strExplain, vbYesNo + vbInformation, strTitle)=6 Then
                  GetKey=InputBox ("Enter the value or key to delete." & vbPara & "Keys must end in a backspace.", strTitle, strNamet1)
            End If
      End If
End Function

Sub ReportErrors(strModuleName)
      If err.number<>0 then Msgbox "Error occured in " & strModuleName & " module of " & err.number& " - " & err.description & " type" , vbCritical + vbOKOnly, "Something unexpected"
End Sub

Sub VisitSerenity
      Dim Ag
      Set Ag=Wscript.Arguments
      If Ag.Count<>1 then
            If MsgBox("This program came from the Serenity Macros Web Site" & vbCRLF & vbCRLF & "Would you like to visit Serenity's Web Site now?", vbQuestion + vbYesNo + vbDefaultButton2, "Visit Serenity Macros") =6 Then
            sh.Run "http:\\\biz\serenitymacros"
            End If
      End If
End Sub

I really don't feel I can accept the points because, the way I look at it, you have done a splendid job which is probably superior to my batch file thoughts so far, and my way would have probably left more to cleanup than yours.  It would also have taken me somewhat longer to test out safely.  I assume you have a number of "guinea pig" workstations at your disposal, whereas mine would have been purely hypothetical without this facility at my disposal.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.