Page 1 of 1 1
Topic Options
#179938 - 2007-08-29 04:28 PM Rename Printer
HaM1 Offline
Lurker

Registered: 2007-08-29
Posts: 2
Hello,

ist there any possibility to rename Printers which are mounted automatically via Addprinterconection?
ATM they named like this: "Printername an ServerIP"
I only want the printername without the "an ServerIP"

Is it possible?

Many Thanks!

Top
#179940 - 2007-08-29 04:44 PM Re: Rename Printer [Re: HaM1]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4567
Loc: USA
With WMI... only works with XP or higher

$remotepc="."
$Service=GetObject("winmgmts:{impersonationLevel=impersonate}!" + $remotepc + "\root\cimv2")
$Printers=$service.execquery ('select * from Win32_Printer')
for each $printer in $printers
? $printer.name
if $printer.name="Microsoft Office Document Image Writer"
$printer.renameprinter("MS Office Document Image Writer")
endif
next

Top
#179941 - 2007-08-29 04:55 PM Re: Rename Printer [Re: Allen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4567
Loc: USA
It's probably do-able via a Reghack too, but you will probably need to do a snapshot of the registry before and after the change, and then restart the print spooler.
Top
#179988 - 2007-08-30 03:20 PM Re: Rename Printer [Re: Allen]
HaM1 Offline
Lurker

Registered: 2007-08-29
Posts: 2
Hi Allen,

thanks for your reply but the script you posted didn't work. I integrated it in my kix sxript but the printer won't be renamed.
Whats my misstake?Or is it a VB-Script?

Thanks!

Top
#179989 - 2007-08-30 03:45 PM Re: Rename Printer [Re: HaM1]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4567
Loc: USA
Without seeing your code, all I can do is guess...

Maybe the users do not have permission to change the name of the printer?
Maybe this only works with local printers?

Try putting some error checking in the code to see what is failing. Modify the original to look something like...

 Code:
  if $printer.name="Microsoft Office Document Image Writer"
    $printer.renameprinter("MS Office Document Image Writer")
    ? "Printer Rename:  " + @serror
  endif


Edited by Allen (2007-08-30 03:48 PM)

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1376 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.111 seconds in which 0.082 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org