Tag Archives: C#

Nortel BCM Log Parser

I had originally coded this project in VB and never got it into a distributable format.  For example, I had all the file paths and database connection strings hard coded.  After educating myself a bit on C# I recoded the application in that language, and have the program using LINQ instead of (oof!) OLE.  I also now have it coded to accept values specific to a user’s environment via an XML settings file.

What the program does at this point is that it reads the call detail recording logs that are stored in a directory and commits them to an MS SQL/SQLexpress database.  For my own purposes I have all the default settings set on the BCM for recording the log files, so if you’ve changed any of these settings this program may not work.  As well, I have my logs FTP’d every day to a server share that I can access via UNC (i.e. \\server\logfiles).

I have a little setup menu within the program so that you can create the database, set the settings, and then write the settings out to an XML file for future use. Using the XML settings file the program can be scheduled to run if the XML settings file is given to the program as a variable (ex, NortelLogParser c:\settings.xml).

In the future I hope to develop a web front end for the database, but for the time being you’ll have to use Excel or some other tool to query the database for the information that you want.

Click here to download.

UPDATE: I just noticed (12/14/2011) that the field detection is still a little buggy, and a feature that I added after the fact of associating a record with the file it came out of lags by a day.  The program is still better than nothing, but I do have to patch it up a bit when I get some time.

Command Line Argument

Firing up the way-back machine, I recalled interfaces from Exchange versions past that would immediately return some nice data, such as mailbox size, item counts, etc.  I set out to try and recreate some of these interfaces, but it seemed that a lot of the coding examples were in C#, a language that I wasn’t very familiar with.

Undeterred, I went through some C# lessons and I now have what I hope is a decent “working IT guy’s” knowledge of it’s inner workings.  Unfortunately at this point, I can’t exactly remember what I was missing from the past Exchange interfaces that drove me to learn C# to begin with, apart from the table that had the mailbox sizes.

I eventually determined that the Powershell command that I needed was:

Get-MailboxStatistics -server <exchange server name>| Select-Object DisplayName, TotalItemSize, ItemCount,StorageLimitStatus,LastLogonTime | Out-GridView”

I figured my C# coding skills would have to apply to something else as I could just as easily put that line into a batch file! For some reason, though, launching the command from a batch file would open the ‘Grid View’, but it would close immediately, so back to C#

I had the program working fine on my desktop, and had it set to either ask for a server name, or accept a command line argument that would contain the server name. For reasons I still don’t fathom, the command line argument wouldn’t work on the Exchange server itself. I eventually had to change the code from:

if (args[0] != null)
ServerName = args[0];


if (args.Length>0)
if (args[0] != null)
ServerName = args[0];

Which makes more sense, I guess, but I don’t know why the former only worked on the desktop unless there’s some variation of the .Net runtimes between the desktop and server in how they handle command line arguments?

Anyway, if you’d care for a little program that auto-launches this grid view, I’ve posted it here.  It includes the user’s display name, their mailbox size, the number of items, and if they’ve exceeded their quota.  You may need this note if you get an ‘index out of bound’ error due to the Powershell visual GUI elements not being installed (obviously you’ll need a 64 bit machine with the Exchange Powershell add-on installed).

Remote Desktop With XP

Faced with an aging remote access server with dubious patches I wanted to move a little more quickly to a Windows Server 2008 R2 terminal server, but there is an issue: there’s no support for NLA connections within XP out of the box.  True, there’s some registry hacks to enable the feature, but I couldn’t have end user’s doing that, so I resolved to write a program to do it for them.  It wasn’t until I was almost done that I discovered that, alas, Microsoft had already written one.

I hate to be outdone to that extent so I’m still posting mine here: a zip file which contains a Windows forms version, and a command line version, both of which run remarkably faster than Microsoft’s patch.  My program(s) will check to make sure that it’s the proper version of the OS (Windows XP with service pack 3) and that the registry entries need to be added (with visual output).  No backups are taken, so use at your own (minimal) risk!

(Although I typically share my code, I must admit to being slightly embarrassed at it’s condition since it’s my first full fledged C# program.  I’ll share if I get around to cleaning it up so that it doesn’t look like a VB guy wrote a C# program 🙂

Now to patch up all the other Windows XP issues with the Remote Desktop Connection services in Windows 2008 r2….