Thursday, October 01, 2009

Switch your mail reader to Thunderbird....NOW!

Please don't wait. I'm usually not one to step on a soap-box to promote a product (steps down...) but this is a good one, one which many already know about and use.

I used to be a heavy Evolution user. Dunno why I initially made this decision, only that it came installed on my Ubuntu Jaunty install as the default email client with the Gnome UI.

I started having some issues with it recently, where the retrieval of my POP3 or sending mail caused it to hang.

Mozilla Thunderbird e-mail clientImage via Wikipedia

I read a few bug reports and posts related to clearing out temporary ~/.evolution files, but this really never worked very well, as the issues always reappeared.

The last straw was not being able to expunge the Trash bin, and after a little bit of playing, decided I needed to migrate my mail to something else.

I figured since I already used Firefox, I might just as well take the Thunderbird plunge. Boy, was I glad I did! It was a snap using these directions, "How To Migrate From Evolution To Thunderbird In Ubuntu Intrepid" posted at MakeTechEasier.com.

I'm quickly finding there are more extensions available for Thunderbird than there was for Evolution.

Weeeeeee!

Reblog this post [with Zemanta]

Friday, September 11, 2009

Programmatically Change Printer Settings

The 'Where do you want to go today?' logoImage via Wikipedia

I recently had the need to provide printer admin access on an ERP server to ordinary users. Nothing makes me shudder more than elevating a users access on a machine that holds your entire business operation on it's drives...

I was able to come up with a solution using CPAU.exe which I've written about here.

The scenario: An active label printer and a backup. When one goes down, the other needs to be put into service, but it needs to have the same name as the active one did. The users then also need to be able to "flip a switch" to put the active one back into service.

First, I needed the guts of the switching script, which makes use of Microsoft's prncnfg.vbs script, stored on all Windows boxes in the %windir%\system32 directory (Called ChangePrinter.cmd):

@ECHO OFF

@SET _ONE=ACTIVEPROD
@SET _ONE_DOWN=ACTIVEPROD_146
@SET _TWO=BACKUPPROD
@SET _HOST=BAPFSVR03

:: PRINTERS RECEIVE ADDRESSES VIA DHCP
:: WHEN NO ERROR CONDITIONS EXIST,
:: THE FOLLOWING IS TRUE
:: ACTIVEPROD = 192.168.10.146
:: BACKUPPROD = 192.168.10.145

:: IF AN ERROR CONDITION EXISTS,
:: THESE NAMES WILL BE SWAPPED
:: TO ACCOMODATE INNATRACK

:: FIRST CHECK FOR EXISTENCE OF ACTIVEPROD_146.
:: IF FOUND, RENAME ACTIVEPROD to BACKUPPROD, THEN
:: RENAME ACTIVEPROD_146 TO ACTIVEPROD.


cscript.exe %WINDIR%\system32\prncnfg.vbs -g -s %_HOST% -p %_ONE_DOWN% | FIND /N "Printer name %_ONE_DOWN%"
IF NOT ERRORLEVEL 1 GOTO BACKINSERV


:: IF THE ABOVE FAILS, WE KNOW ALL WE HAVE TO DO
:: IS MOVE ZEBWD1 TO ZEBWD1_146, AND MOVE ZEBWD2
:: UP TO THE #1 SPOT

ECHO REPLACING ACTIVEPROD
cscript.exe %WINDIR%\system32\prncnfg.vbs -x -s %_HOST% -p %_ONE% -z %_ONE_DOWN%
cscript.exe %WINDIR%\system32\prncnfg.vbs -t -s %_HOST% -p %_ONE_DOWN% -h %_ONE_DOWN% -l "Out of service"
cscript.exe %WINDIR%\system32\prncnfg.vbs -x -s %_HOST% -p %_TWO% -z %_ONE%
cscript.exe %WINDIR%\system32\prncnfg.vbs -t -s %_HOST% -p %_ONE% -h %_ONE% -l "In Service"
GOTO OUT


:BACKINSERV
ECHO PUTTING ACTIVEPROD BACK INTO SERVICE
cscript.exe %WINDIR%\system32\prncnfg.vbs -x -s %_HOST% -p %_ONE% -z %_TWO%
cscript.exe %WINDIR%\system32\prncnfg.vbs -t -s %_HOST% -p %_TWO% -h %_TWO% -l "Training - Backup Printer"
cscript.exe %WINDIR%\system32\prncnfg.vbs -x -s %_HOST% -p %_ONE_DOWN% -z %_ONE%
cscript.exe %WINDIR%\system32\prncnfg.vbs -t -s %_HOST% -p %_ONE% -h %_ONE% -l "Production Printer"

:OUT
::EXIT

This is placed in a directory, along with CPAU.exe, and the following script (Called RunChangePrinter.cmd):

@ECHO OFF
cpau.exe -hide -file ChangePrinter.txt -dec -lwp

The above file references ChangePrinter.txt, which was generated by entering the following in a CMD window:

\\myserver\mypath\cpau.exe -u mydomain\myadmin -p %PASSWORD% -ex \\myserver\mypath\ChangePrinter.cmd -file \\myserver\mypath\ChangePrinter.txt -enc

Then simply create a shortcut to RunChangePrinter.cmd and place it where my users can find it!

Reblog this post [with Zemanta]