Unable to use grep to search logfiles output from Powershell scripts

I recently had to do some PowerShell work on a Windows server which outputted some log files for later review using the “Start-Transcript” function.

Later I went to review the logs looking for some specific information. I transferred them to my CentOS 5 Dev system to begin analyzing them with grep.

Every time I ran a grep command against the logs no results were returned. Very strange. Even if I used ‘cat’ first and then tried to grep that output grep would return no results.

Turns out the version of grep on CentOS 5 (GNU grep 2.6.3) does not support UTF-16 which is what my PowerShell logs were encoded in.

I ran the following command (thanks SuperUser) and converted all of my logs to UTF-8 and then grep began functioning properly again.


Powershell script to report on total send/received e-mails in Exchange

This is a simple PowerShell script that pulls all of the send/received e-mails from the Message Tracking log in Exchange 2010 and counts the unique header IDs.

It’s fairly accurate but I don’t think it’s 100% bang on. My testing showed the numbers generated to be off by about 10%.

This script was built for generic mailboxes but should work on individual mailboxes as well.


I have a scheduled task configured on one of our Exchange servers that runs this every Monday morning and provide me the stats on a generic mailbox for the previous week (Monday – Sunday).

Powershell script to create reverse lookups (PTR) in Microsoft DNS

We’re switching IP spaces at work and need to create a large amount of reverse lookup PTR records for our PAT/NAT pools.

Microsoft only allows you to manually create one DNS entry at a time via the GUI so I wrote a simple Powershell script that lets you mass create sequential PTR records.



Symantec Backup Exec RALUS crashes on CentOS 7

We just deployed our first CentOS 7 machine and are trying to back it up using Backup Exec 2010 R3 and the RALUS agent.

After installing the missing compatibility libraries needed for the RALUS:

the agent installs and starts but once the Media Server connects to it the agent crashes.

Some log digging came up with this from /var/log/messages:

and running the agent in debug mode shows this:


I’ve opened a case with Symantec and their answer was that CentOS isn’t supported and neither is RHEL7.

Anyone else running into this? Have you fixed it?

I found a blog post where someone suggested hex editing the beremote binary which I’d rather not do. Plus our version of the agent is newer than the one he describes in his post: http://blog.redweb.at/2012/08/howto-backupexec-2012-linux-agent-and-kernel-3-0-debian/

How to upgrade CentOS 6 to CentOS 7

This article comes with a HUGE warning. This was written using beta tools available from here: http://dev.centos.org/centos/6/upg/x86_64/Packages/

I will likely update this article when these tools are no longer in beta and when I perform this on my more complicated production server. Right now I’m testing these packages and this method on a relatively simple CentOS 6 test server I have at work.

My test server has the basics on it like Apache, PHP, NFS, VNC, Samba and Gnome. It is a vSphere VM with 2vCPUs, 4GB of RAM and the storage is back ended on a NetApp via NFS.

I pieced this together using the references at the bottom of the post. This will probably work for upgrading RHEL6 to RHEL7 as well but you’ll need to figure out the mirror information. I don’t have access to RHEL repos.



  1.  Download the upgrade packages from http://dev.centos.org/centos/6/upg/x86_64/Packages/

  2. Install the tools. My server needed some pre-reqs which yum took care of
  3. Run the upgrade tool
  4. The tool will now warn you that you should have taken a full system backup. Hopefully you did. Press ‘y’ to contiune
  5. The tool will now run a bunch of tests to determine if there are any blockers for an upgrade. This took about 10 minutes on my system. Once the tool completes it’s assessment you’ll find an upgrade report in ‘/root/preupgrade-results/’
  6. Review the files in the report. Mine came out with no results…. I take this to mean it found nothing wrong with an in place upgrade…. or there is a bug in the tools. The readme included this description of each file and status descriptions:

  7. Since my report didn’t lead me to believe there were any issues that had to be dealt with pre-upgrade I went for it. First I had to import the repo key and then I ran the upgrade

    Note: I had to add “–force” to the above command. It kept telling me I had not run ‘preupg’ which I had”
  8. After running the above command things started happening. From what I’ve read online this process will take up to 90 minutes while it downloads updates, creates a new boot image, reboots the server and performs the upgrade. The system will automatically reboot when it’s ready.On my system spec’d out as I listed above on a 300mbit internet connection the upgrade process took about 45 minutes.

That’s it! After a few reboots I ended up with a CentOS 7 machine…. with a few issues.

In my case Gnome would load a black screen and there were about 164 CentOS 6 packages left that were not upgraded to their equivalent CentOS 7 packages which caused ‘yum update’ to not work anymore citing dependency issues.

I also had a package, pywebkitgtk, which I had installed that was causing ‘yum update’ to not function properly after adding the EPEL Beta 7 Repo. A quick ‘yum remove pywebkitgtk’ and then ‘yum update’ fixed that.

Apache wasn’t very happy either. The config file needed a lot of work.

On my server there ended up being about 134 CentOS6 packages left over which may or may not cause conflicts in the future.

While this technically worked I’m going to recommend side-by-side upgrades to a fresh CentOS 7 server as the better way to do this. I also believe it is the recommended best practice.