#167693 - 2006-09-19 09:08 AM
Re: Rename Printers
|
Nazeedah
Fresh Scripter
Registered: 2006-09-15
Posts: 20
|
Hello I think taht this code should work, after lots of reading I have run this script below:
Rem Set the local variables SetLocal
Rem Wait about 15 seconds to let the terminal server map the printer... Sleep 15
Rem Reads the default printer from the registry "%SystemRoot%\Application Compatibility Scripts\acregl.exe" DefPrint.cmd DefaultPrinter "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows" "Device" ""
If Not Exist DefPrint.cmd (Call :Error 1) && (Goto EoF)
call DefPrint.cmd del DefPrint.cmd
If Not Defined DefaultPrinter (Call :Error 2) && (Goto EoF)
Rem 2000 :: DefaultPrinter = HP DeskJet 820CSe on oz/TINMAN/Session 1,winspool,TS001 for /f "tokens=1 delims=," %%i in ('"echo %DefaultPrinter%"') do set OldPrinterString=%%i for /f "tokens=1 delims=/" %%j in ('"echo %DefaultPrinter%"') do set PrinterString=%%j
Rem 2000 :: PrinterString = HP DeskJet 820Cse on oz/%clientname%/session 1 Rem Attempt to rename the printer... rundll32 printui.dll,PrintUIEntry /Xs /n "%OldPrinterString%" printername "%PrinterString%"
Rem Done! EndLocal Goto EoF
:Error msg %SessionName% /W Your printers were not successfully renamed. Please notify an administrator. (Error Code: %1) EndLocal Goto EoF
:EoF
but i am having an error at the code below especially at "%PrinterString%" . i have to run this on Windows 2000 server.
rundll32 printui.dll,PrintUIEntry /Xs /n "%OldPrinterString%" printername "%PrinterString%"
Thanks a lot
Nazeedah
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 388 anonymous users online.
|
|
|