Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

delete printer script 1

Status
Not open for further replies.

texasit

MIS
Jun 26, 2008
21
US
is there a way to modify this bat command so that when its ran it prompts for which printer to uninstall instead of having to edit the script each time to reflect a different printer?

runas /u:\%computername%\anthony rundll32 printui.dll,PrintUIEntry /dl /n "printer_name" /c\\computer_name
 
I'm sure there is but this is a VBS forum, not a BATCH forum. Therefore,

[red]XP Only![/red]
Code:
set objShell = CreateObject("WScript.Shell")
set objNetwork = CreateObject("Wscript.Network")

strComputerName = objNetwork.ComputerName
strPrinter = inputBox ("Printer Name")
strCommand = "runas /u:" & strComputerName & "\Anthoy ""rundll32 printui.dll,PrintUIEntry /dl /n \""" & strPrinter & "\"" /c \\" & strComputerName & """"

objShell.Run strCommand

-Geates

"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Thanks for the help again Geates, unfortunately my corporate environment has a mix of XP and windows 7. I will have to keep looking on a solution.
 
I was mistaken, it does run on Win7 (sort of) The windows 7 Runas.exe see the program name as "[red]rundll32 printui.dll,PrintUIEntry /dl /n / "printer_name"[/red]" as the program name with no arguments. XP's Runas.exe sees the program name as "[red]rundll32[/red]" with several arguments. [thumbsdown]


-Geates

"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
I tried it and it seems to be working .thanks Geates!
 
Good deal! I could only get it to work on my machine if I removed the argument quotes.

-Geates

"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top