Archive for March, 2012

Recently I was tasked to create MSI installer for our current application which is in development phase. While browsing project types in VS, I had known that VS has ability to create installer using Install Shield, but that was pretty much of it. I have never worked with them before. But after working with windows installation project for few days, it looks pretty straight forward process to me. I mean of course, we can customize installer anyway we want and it can get pretty complex subject, but out requirement was not so fancy (at least at this moment ) so I am overall enjoying working with it.

For this demo I have created a very simple console application in C# and I am creating installer for that app. This installer will allow user to install that app to any location, just like any other app. And this application is targeted for only 32bit machines. This console application basically runs in a loop until user quits it, with each loop it displays two random number and user is required to add them (I know its pretty basic app .. but this demo is for installer not for some fancy app ). I am actually following old MSDN walkthrough which explains step-by-step process to create MSI installer.

First, I have created a console application project “Installer Demo”. Like below.

Shell is not a new thing for any older timer … or for folks working with forbidden OSes like Unix and Linux. It is primary utility used by users to interact with those systems (and in older days it was perhaps the only way of interaction). Till few days back, I was obsessed with DOS and batch files. And I tried to do most of system automation tasks using them. I even received comments from Boss, that I can do better if I use PowerShell instead of DOS. But like some old lady obsessed with her old hat or something, I was reluctant to give away old love for DOS.

But recently I went to local Access user group meeting here at CT. And there was presentation for “Introduction to PowerShell for Database Developers”. And I realized that all this time I was just ignorant to not to use PowerShell. You have whole .NET stack for you to consume in addition to support of both DOS and Unix Shell commands !! In simple words, PowerShell is really A Shell on Steroids.

And with this new “inspiration” I have decided to give PowerShell a try and use it for automation tasks in newer systems (mostly Post Windows Server 2003 R2).

Couple of days back, I created a VB Script to send email notification to users using any publically available SMTP servers like Google or Yahoo. That script was actually using built in class “CDO.Message” for configuration and sending email. This can be in done same manner by creating simple .NET console application just like below,

In my never ending desire to use Batch files to do just about anything, I was recently needed batch file to send an email to users once task is completed with “Success” or “Failure” results. And since I was already using batch files to donumber of things, I thought it wouldn’t harm if it can do one more thing …. send email to users !! Actually it is not possible to send email just from plain DOS commands so I added a bit flavor to it with use of good ‘ol VB Script. This distant cousin of batch script has always been popular among system admins, hackers and various other titles you can think of, due to its ability to access system level resources and more close ties to standard programing language VB.

I found over Google that most people suggest to use “CDO.Message” object to send email in VB Script. But there were not any “correct” script which solved my problem, it is because most of those scripts were required me to install SMPT server in my machine. But finally I was able to find a script which was doing exactly what it suppose to do (I honestly don’t remember which site was that because I had checked number of forums).

Finally working script is (with minor modification to original script),

If you have ever used If .. Else in batch file then you know that how frustrating it is to work with it. In fact if you google this case then you will find that it is very common belief that ELSE doesn’t exits for BATCH files !!! I think it is just because very specific requirement to use this command is to write them in proper format.

Recently I had to add some “extra” feature in my backup script … an email notification via batch file for success or failure of operation. After spending many hours in forums finally I was able to figure out this mystery. Batch script will recognize If .. ELSE … only if it is written in following format,

Few days back I was just goofing about in system I stumbled upon really interesting feature of Windows 7 it is called … “Problem Step Recorder”. I am surprised that MSFT has not given it any short ‘n sweet name but rather strange and mouthful name … But as you can guess from it’s name it does exactly what it says, it records steps which can be used to reproduce any issue by support people.

Actually when it says “record” it doesn’t actually create some video but it take snapshot of each steps use do and compiles it in a MHT file. User can also enter comments in slides to provider detailed information to support guys. Even thought it has some fundamental limitations which might render it useless for some users ( like limitation of max. 25 screenshots, but again if you can’t repro issue in 25 steps then dude I don’t think anyone can help you) but for most of mere mortals this will be really great tool to support users.