Export Groups and Group Types from Active Directory

A quick post on something I had to do at work today.  Luckily it didn’t take too long to research how to do it, but the information wasn’t clearly on one page.

So, are you looking to get a full export of groups and group types from Active Directory?  Look no further!  This is what you need to do in order to get all of the group names and group types from active directory – whether they be built-in groups, domain local security groups, global security groups, universal security groups, domain local distribution groups, global distribution groups, or universal distribution groups.

First of all, you need a Microsoft utility called CSVDE.EXE.  This is a program that will allow you to query the Active Directory LDAP database and return results you need.

Next, here is the command you will use.  If you have multiple domains, you will need to run this query on one server in each of your Active Directory domains to get all groups in Active Directory for each domain:

csvde.exe -s <server> -f <export-filename> -l groupType,name -r “(objectCategory=group)”

This will then export the file to a CSV file with two fields – the name of the group and the type of group. Now, when you open the file, you are going to see a bunch of numbers in the groupType column. Here is the translation for each of those numbers:

Domain Local Security-2147483644
Global Security-2147483646
Universal Security-2147483640
Domain Local Distribution4
Global Distribution2
Universal Distribution8

In Excel, you can quickly replace each of those by hitting Ctrl+H (which opens the Replace window). Start at the top with the Built-In numbers above and then just replace it with the text you want to change it to!

Downgrade From PHP 5.2 to PHP 5.3 on Ubuntu Lucid 10.04

After the Decatur server was upgraded to the newest long-term-support release of Ubuntu 10.04 (Lucid), there were a few issues that occurred.  This is because Ubuntu 10.04 Lucid includes the PHP 5.3.2 version with the release.  To me, this was good news because I would prefer to stay ahead on these kinds of things that are facing the Internet and could be prone to security issues.  Before the upgrade, I was using PHP 5.2.4 on the servers.

The graphic utility that I use to graph network status, e-mail status, and other server status items had some graph issues.  That is because of some “Deprecated” errors that were messing with the graphic utility’s stuff.  That was easily fixed by turning off error-reporting for the command-line interface (cli) version of the php.ini file found in the /etcphp5/cli folder.

Then I came across another problem.  Joomla 1.0.x sites.  I have Several Joomla 1.0.15 sites running on my systems.  Well, unfortunately, Joomla no longer supports the 1.0 version.  This is going to be pretty hairy if there are problems in the future.

The problems with Joomla 1.0.15 sites were that the Contacts page would be completely blank.  If you try to go into the Administrator portal and look at the contacts, it was also a white page as well.  In addition, the content area of all of the web pages were blank!  The modules and other aspects of the template would load fine, but the main body content was completely empty.

Searching through some forums on this issue, I was able to fix the Joomla 1.0.15 blank content problems by doing the following.

Open the file “includes/Cache/Lite/Function.php” file.  Search for this line:

$arguments = func_get_args();

Now, you need to replace it with this code:

$arguments = func_get_args();
$numargs = func_num_args();
for($i=1; $i < $numargs; $i++)
{ $arguments[$i] = &$arguments[$i]; }

Now, one more update.

Open the file “includes/vcard.class.php” and before line 38, you need to add this.  Note that the brackets need to be around code that is already there – which is lines 38 to 77:

/* line 38 to 77 */

Your site should now work.  If you have difficulties with that, download the Joomla 1.0.15 patch for PHP 5.3 and above here.  The files are text files so rename them with a “.php” extension and then place them in the proper directories (as I outlined above):


OK, so all the of the Joomla 1.0.x sites were back up and running after running those changes on PHP 5.3.2!

Well, the next morning, I saw a few e-mails about another website that was not working; the main page was working and other aspects, but the areas where users logged in registered, or did other activities – was a blank page!

I messed with this for hours upon hours and tried to fix what I could before it was time to quit.  The individual had a developer create the website for them – and they used a program called CakePHP Framework.  The version they used was old as the hills – version  Unfortunately, CakePHP does not support PHP 5.3 until CakePHP 1.3 versions.  Well, there was still ways to fix it and as many other folks online posted, they got their site working with PHP 5.3 using CakePHP 1.2 without trouble.

However, the pages that were not working were completely white – nothing; no debug information or help to be provided at all.  I did manage to get some errors out of the page by trying other methods – which were:

Deprecated: Assigning the return value of new by reference is deprecated in /<path>/core/cake/libs/inflector.php on line 131
Deprecated: Assigning the return value of new by reference is deprecated in /<path>/core/cake/libs/configure.php on line 136
Deprecated: Assigning the return value of new by reference is deprecated in /<path>/cake/libs/configure.php on line 226
Deprecated: Assigning the return value of new by reference is deprecated in /<path>/core/cake/libs/configure.php on line 911
Deprecated: Assigning the return value of new by reference is deprecated in /<path>/core/cake/libs/configure.php on line 951
Deprecated: Assigning the return value of new by reference is deprecated in /<path>/core/cake/libs/cache.php on line 71
Deprecated: Assigning the return value of new by reference is deprecated in /<path>/core/cake/libs/cache.php on line 155

So, trying to fix it like the other folks did with CakePHP 1.2 on PHP 5.3 or older, I went into those files and replaced some text on those lines.  PHP doesn’t support clone code in such a way.  So, on the lines above, I changed:

=& new

To this code:

= clone new

This completely got rid of the errors and there was nothing reported.  I even went into the config/core.php file and changed the debug mode to 1, 2, and 3 at different times to try to get something out of the site – but NOTHING would give!  It still continued to be a blank white page with no warnings or errors.

So, i gave up.  The developers indicated that the site would not work if the PHP version was 5.3.2 or greater.

So, I then had no other choice but to downgrade Ubuntu 10.04 Lucid from PHP 5.3.2 to 5.2 – which happens to be 5.2.10 that was installed (hey, at least it is newer than the 5.2.4 – but it still is a year old on the build date).

So more work and stress later, I am back to PHP 5.2.10 on the server without any troubles (so far!).  Here is how PHP was downgraded from 5.3 to 5.2 on Ubuntu Lucid 10.04.

You first need to find out what PHP items you have installed – which can be done by:

sudo dpkg -l | grep “php”

It will list all of the PHP packages that are installed on your server. Write all of them down! You will need to remove all of those. So, do that here:

sudo apt-get remove php5 php-date php-http-request php-log php-mail-mime php-mimedecode php-net-socket php-net-url php-pear php5-cli php5-common php5-curl php5-dev php5-gd php5-imagick php5-imap php5-mcrypt php5-mysql php5-snmp libapache2-mod-php5 libphp-adodb

Your list WILL be different than what I have above – but ensure that when you remove those items, it may throw in a few other packages that need to be removed – due to dependencies. Ensure that you write all of them down so you can re-install them after this process.

Good, now you have all of those removed. Now, a few more steps to go. First, you need to make a copy of your /etc/apt/sources.list file and point it to Karmic – which was the previous release that has PHP 5.2.10 on it. To do so, simply issue this command at the prompt:

sudo sed s/lucid/karmic/g /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/karmic.list

The above code makes a coupy of your /etc/apt/sources.list and places it in the /etc/apt/sources.list.d folder and calls it karmic.list. Basically it replaces all “lucid” occurrences in the file with “karmic” and copies it. Now, do a:

sudo apt-get update

This will then allow apt to refresh itself and download all of the headers for the Ubuntu Karmic files (since it is reading that new file now).

OK – now you need to create one file that you will basically use to tell the package manager to NOT upgrade and to only use the versions from the Karmic release. You can name this file whatever you want and place it in the /etc/apt/preferences.d folder (I just called mine php). In this file, you need to list EVERY package that you want to be downloaded from the Karmic repositories and NEVER from the Lucid repositories. Below is my list. You should have EVERY package that you just removed listed in here.

Package: php-date
Pin: release a=karmic
Pin-Priority: 991

Package: php-http-request
Pin: release a=karmic
Pin-Priority: 991

Package: php-log
Pin: release a=karmic
Pin-Priority: 991

Package: php-mail-mime
Pin: release a=karmic
Pin-Priority: 991

Package: php-mimedecode
Pin: release a=karmic
Pin-Priority: 991

Package: php-net-socket
Pin: release a=karmic
Pin-Priority: 991

Package: php-net-url
Pin: release a=karmic
Pin-Priority: 991

Package: php-pear
Pin: release a=karmic
Pin-Priority: 991

Package: php5
Pin: release a=karmic
Pin-Priority: 991

Package: php5-cli
Pin: release a=karmic
Pin-Priority: 991

Package: php5-common
Pin: release a=karmic
Pin-Priority: 991

Package: php5-curl
Pin: release a=karmic
Pin-Priority: 991

Package: php5-dev
Pin: release a=karmic
Pin-Priority: 991

Package: php5-gd
Pin: release a=karmic
Pin-Priority: 991

Package: php5-imagick
Pin: release a=karmic
Pin-Priority: 991

Package: php5-imap
Pin: release a=karmic
Pin-Priority: 991

Package: php5-mcrypt
Pin: release a=karmic
Pin-Priority: 991

Package: php5-mysql
Pin: release a=karmic
Pin-Priority: 991

Package: php5-snmp
Pin: release a=karmic
Pin-Priority: 991

Package: libapache2-mod-php5
Pin: release a=karmic
Pin-Priority: 991

Package: libphp-adodb
Pin: release a=karmic
Pin-Priority: 991

Now save that file. Two more commands. The first one – install the PHP version 5.2.10 from the Karmic repositories. Again, install only those that you removed from the previous remove command.

sudo apt-get install php5 php-date php-http-request php-log php-mail-mime php-mimedecode php-net-socket php-net-url php-pear php5-cli php5-common php5-curl php5-dev php5-gd php5-imagick php5-imap php5-mcrypt php5-mysql php5-snmp libapache2-mod-php5 libphp-adodb

Now, just restart Apache!

sudo apache2ctl restart

Apache should now be using PHP 5.2.10. After running this, the website that was having all the problems jumped back to life and was fixed.

Cannot Boot After Installing DMRAID

As I am getting ready to upgrade my hosting servers, I’ve been doing some research on how to get a mirrored RAID-1 array set back up.

Back when the Paris server was the main server and it was built, it was setup with two hard drives in a RAID-1 array using the BIOS RAID – which was on an nVidia RAID motherboard.

Well, this kind of RAID array is not a hardware RAID array – but it is a software RAID array.  It does have the firmware in the BIOS that allows for a nVidia RAID Configuration Utility by pressing F10 after the BIOS screen is done.  That is handy – and that is where you can setup your RAID array.

Of course, the drivers for this are made for Windows – and is called the nVidia MediaShield.  You have to install these drivers to make use of the RAID array.  This is because this type of nVidia RAID array built onto the motherboard requires both the software to be installed and the functions in the BIOS.  Hence, most people call this a FakeRAID or SofRAID setup.  Unless you shell out a large sum of money to get a real hardware RAID card with onboard processing and memory, you are stuck with this low-cost alternative.

FakeRAID setups require the use of the main processor on the motherboard to do most of it’s tasks.  That is fine in today’s world of 3.0 GHZ dual-core and quad-core processors.  That is also fine if you are running Windows with the nVidia Media Shield installed where you can manage your array and ensure it is in good health.

But, it is a little different in the Linux world.  Originally when the below issues happened – it was when using Ubuntu 8.04 – which had the older version of “dmraid” (the 2006 version – you can check your version of dmraid by typing ‘dmraid –version’ at a terminal).

Well, I already have a full server install on my PC.  All of the documentation on how to setup a FakeRAID array in Ubuntu is all for folks that want to install Ubuntu fresh – not after the fact like what I need done.  I’m sure I’ll have another post on this issue soon once my new hardware arrives and I go through the process – as I have a fairly good idea how I can setup a FakeRAID on Ubuntu after installing.

So, I just wanted to see what ‘dmraid’ was all about so I did the usual ‘sudo apt-get install dmraid’ at the command prompt.

Very strange – after I installed it, I issued a ‘dmraid -r’ command it it showed that i had one drive in the mirror (the only drive in the system currently) and it was in a mirror mode.  Hmm – I never setup a mirror on this drive – so how could this be possible?  Well, it may be possible because when I setup the Decatur server, I took the mirrored drive from the Paris server to put in the Decatur server – therefore it stopped the RAID-1 array on the Paris server.  Because of that, the RAID metadata was probably still on the hard drive that I put in the Decatur server.

Well, I didn’t think this would be a problem.  I was cleaning the server and getting ready for the new RAID cage and hard drives to show up and shut the server down.  Upon reboot, the server would not boot!  It would go to the Grub menu and dmraid would show that there was an ERROR – degraded array.  Then when Grub tried to continue the boot process, it would not boot.  It said ‘device or resource busy’ after installing dmraid.

I tried to search all that I could on this issue but there just wasn’t a solution.  In my Grub menu.lst file, the boot sequence is done by using the UUID of the hard drive.  So the Grub menu.lst was not changed after installing dmraid – but the computer still would not boot.

I went into my BIOS and checked things.  Sure enough, I had the SATA in Normal mode and not in RAID mode.  I was confused.

So, it was decided to go ahead and change the mode to RAID mode and ensure that SATA-1 was enabled for use in RAID.  Upon reboot, I got the nVidia RAID Configuration notice to press F10 along with blinking red letters indicating my RAID array was degraded.  Hmm.. maybe I am on to something now.

In the nVidia RAID Configuration Utility, it showed that the drive was part of a mirror.  Again – this may have been caused from this drive being used in the Paris server in a RAID array and it still had the RAID meta-data on the drive.  So, I deleted the RAID array but left the MBR and data intact and rebooted.

Success!  Now when Grub loaded, dmraid said ‘NO RAID DISKS’ and then the server continued to boot up!

So what happened here?  It seems that dmraid will take over any disks and assign them to a /dev/mapper/……. location.  So since dmraid was loaded before Grub started the full boot-up process, the hard drive was already in use – hence the ‘device or resource busy’ error message.

Today I have upgraded the Decatur server to Ubuntu Lucid 10.04 from 8.04.  While there were a few things that needed fixed (like websites running Joomla 1.0.x versions because of incompatibilities with PHP 5.3) and other small configuration changes here and there, the upgrade process went smooth.  And Lucid 10.04 includes the most updated version of dmraid – version 1.0.0.rc16 (2009.09.16).  I’ve heard that the old version I was running had problems trying to rebuild RAID arrays using the nVidia FakeRAID and this issue is supposedly fixed in the new version – although I’ve not been able to confirm that from anyone.

While a hardware RAID solution is by far the best solution, I’m not going to throw $100+ into a RAID card on each server to do so.  I’m just hoping for the best with using the FakeRAID in Ubuntu and hoping that all of these little glitches and problems are taken care of.  The whole point of using a RAID-1 array is to have that backup mirror.  But if you cannot rebuild that mirror after a drive fails, what is the point?  I guess that will protect you from one hard drive failure.

Tilling In Mulched Leaves

The weather has taken an unexpected rise!  This week the temperatures have been in the 70’s.  Unfortunately now with the time change, it gets dark by 5 pm and I get home less than an hour before that.  So that doesn’t leave much time to do anything.

Monday I got the rain barrels taken out of the loop for the water.  I put the regular downspout back into place so that water is not delivered to the rain barrels.  I also took one of those makeshift power sprayers (just attaches to your regular hose but has a very fine tip so it has a stronger stream of water) and cleaned out the more translucent barrel.  It was filled with algae and had a thick floating layer of algae on the bottom of the barrel where there was still a bit of water.  Not all of the algae came off and there is a substantial amount left on the sides of the barrel – but that is how it goes.

This past weekend and the weekend before I got a huge amount of leaves tilled into the front garden and the garden behind the garage.

Since we have a woods-like area behind the house, we have a huge bounty of leaves that we can use as free fertilizer and this greatly adds in some organic matter into the garden.

The neighbor used his blower and made some large piles of leaves in his yard.  I also raked our yard a few times.  Then I take our leaf blower – which doubles up as a mulcher – and mulched up all of the leaves and placed them in some large trash containers that the neighbor let me use.  He has two of these.

Lots of Leaves

I used one of these containers EACH on each part of the front garden.  After I filled the containers like the one above, I got into them and jumped on them to really compact and make more room.  I bet there was over 50 pounds of leaves in the containers by the time I was done.

Surprisingly – two of these containers were fully tilled into the front garden on October 31st.  I expected to only fit one of these containers into the front garden – but nope!  After it was all tilled in, it didn’t even raise the level of the garden one bit!  It almost seems that there are places that need more soil added!  Where the heck did all the leaves go?

Tilling In Leaves

This past weekend I then added TWO more of these large containers to the back garden.  The back garden is about five feet wide by 27 feet long.  The front garden has two areas that are four feet by 20 feet.  So I was surprised that I fit two containers of leaves (probably 100 pounds) into the back garden.

Tilling In Leaves

I still need to till leaves into the garden that is next to the house!  Right now I have two 32-gallon containers full of leaves – but that is all!  That probably would be enough to put in that area – but I also need a good amount of leaves to mulch the garden next year (used both 32-gallon containers last year to mulch the front garden).  I also would like to hill up the potatoes next year using leaves instead of hauling in more dirt.  It will also make digging for the potatoes much easier with loose leaves than soil.

So, that is all that is happening around the garden.  Nothing growing – of course!  But I am surprised to see that the lonely carrot and the radish plants are still alive even after several frosts and some hard freezes!

I haven’t had the chance to tally up all of the data for this year’s produce but I will do that sometime before the end of the year.  I did just get all of the peppers cut up this evening from the last big amount.  We have been using them in salads and other dishes over the past two weeks – but the peppers were beginning to get a little soft – so it was time to cut them up and place them in the freezer.  Now we have about six or seven bags of peppers in the freezer.  I guess that takes the place of all the green beans that we had last year – that never produced well this year.