?
Solved

remotely delete windows 98 printers

Posted on 2003-03-20
7
Medium Priority
?
203 Views
Last Modified: 2013-12-28
Hello,

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.

thanx,
Shaun
0
Comment
Question by:sbradley2002
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 97

Expert Comment

by:war1
ID: 8178725
Greetings, sbradley2002!
   Where you looking for a program like PC Anywhere?

Best wishes, war1
0
 
LVL 97

Expert Comment

by:war1
ID: 8178754
sbradley2002,
   Here is a free remote desktop Tridia VNC

http://www.tridiavnc.com/
0
 

Author Comment

by:sbradley2002
ID: 8178776
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.
0
Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

 
LVL 38

Accepted Solution

by:
BillDL earned 750 total points
ID: 8179463
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:

HKEY_LOCAL_MACHINE\Config\0001\System\CurrentControlSet\Control\Print\Printers

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

Author Comment

by:sbradley2002
ID: 8208129
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
endif
Have you run your test yet?
0
 

Author Comment

by:sbradley2002
ID: 8215997
OK,
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

[Version]
signature="$CHICAGO$"

[DefaultInstall]
DelReg = RegChange
UpdateInis = EraseWinINIEntrys

[RunIt]
DelReg = RegChange
UpdateInis = EraseWinINIEntrys

;HKCR is short for HKEY_CLASSES_ROOT
;HKCU is short for HKEY_CURRENT_USER
;HKLM is short for HKEY_LOCAL_MACHINE
;HKU is short for HKEY_USERS

[RegChange]
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"

[EraseWinINIEntrys]
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=*",
;-------------------------

cya,
Shaun
0
 
LVL 38

Expert Comment

by:BillDL
ID: 8219206
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.

http://www.eytcheson.com/faq.htm
Multi Remote Registry Changer  (MRRC)
http://www.eytcheson.com/download.htm

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:

http://www.mvps.org/serenitymacros/help.html

Their explanation:
-------------------

RegDelete.vbs
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.

Syntax
--------
[path] RegDelete [Key] | [Value]

Code:
-----------
'RegDelete.vbs
'Deletes keys or values from the registry.
'
'Serenity Macros       http://www.angelfire.com/biz/serenitymacros
'David Candy      davidc@sia.net.au
'
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"
Key=""
Dim silent
Silent=""

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

Key=GetKey()
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
            Else
                  ReportErrors "DeletingKey"
            End If
      Else
            If Err.Number=-2147024893 then
                  Err.Clear
                  MsgBox Key & " didn't exist", vbOKOnly + vbCritical, strTitle
            Else
                  ReportErrors "Reading before Deleting Key"
            End If
      End If
End If

ReportErrors "Main"
VisitSerenity

Function GetKey()
      Dim Ag
      Set Ag=Wscript.Arguments
      ReportErrors "Creating Aguments"
      If Ag.Count=1 then GetKey=Ag(0)
      Silent="yes"
      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"
      Err.clear
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:\\www.angelfire.com\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.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
In this modest contribution, I want to share with the IT community (especially system administrators, IT Support Engineers and IT Help Desks) about Windows crashes/hangs and how to deal with these particular problems.
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

762 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