I am trying to make a script that will delete a printer from a pc. For example I am on pc 1234 and want to run this program that will ask me for the pc i want to delete the printer from and what printer it is. So pc 789 i want to delete printer123 on printerserver
I have the following so far but it does not work Any help would be appreciated. Thank You
@echo off
:start
@echo This will delete network printers from a remote pc
@echo.
@echo Please type in the Asset Tag of the device to delete from
set /p tag=
@echo Please type in the Printer Name that you would like to delete
set /p printer=
rundll32 printui.dll,PrintUIEntry /dn /c\\%tag% /n\\dvmsprn04\%printer%
@echo.
@echo Delete another (y/n)?
set /p another=
if '%another%'=='y' goto start
if '%another%'=='n' goto end
:end
exit
Delete network printer from a remote pc
Moderator: DosItHelp
Re: Delete network printer from a remote pc
Hmm. Looks right for me. If you run
rundll32 printui.dll,PrintUIEntry /?
you will find the same syntax like yours. But the M$ support shows an opposite style for /c and /n options:
No idea if this makes a difference.
Did you try to run as admin?
Or maybe it's not available on your OS. Did rundll32 printui.dll,PrintUIEntry /? work for you?
Regards
aGerman
rundll32 printui.dll,PrintUIEntry /?
you will find the same syntax like yours. But the M$ support shows an opposite style for /c and /n options:
The following example deletes an Agfa printer on a computer named SERVER:Code: Select all
rundll32 printui.dll,PrintUIEntry /dl /n "Test Printer" /c\\SERVER
No idea if this makes a difference.
Did you try to run as admin?
Or maybe it's not available on your OS. Did rundll32 printui.dll,PrintUIEntry /? work for you?
Regards
aGerman