Thursday, March 17, 2011

SQL Server PowerShell Extensions and MySQL

For quite a while now I have been looking for an easy way to use MySQL databases with PowerShell. Everything I had read and found about it earlier made it seem like quite a hassle. All of that seems to have changed for me today when I found the latest release of the SQLPSX included a mysql module as well as the SQL Server and Oracle modules they had previously had.

Well, I dug right in and figured out what was necessary to get this running. With a little assistance from get-help and some previous knowledge of I was able to get a sample script up and running. Note that beyond installing SQLPSX, you will also need to install the MySQL Connector/Net to provide the .NET bindings that this module needs.

Below you will see some sample PowerShell code that I got working. It just simply connects to the server and queries the user table, and spitting it out. Of course this is just a proof of concept, you can see

# simple script to test the new mysql module in sqlpsx
$server = 'servername'
$user = 'dbuser'
$pass = 'dbpass'
$database = 'databasename'

Import-Module mysqllib

$conn = New-MySQLConnection -server $server -user $user -password $pass -database $database

$res = Invoke-MySQLQuery "select * from user" -conn $conn

foreach ($line in $res) {
Write-Host $line.User
Of course this is just a proof of concept, but you can see the simplicity of how this can be used. Hopefully in the future, I will have time to show some greater use of this new found tech.

Friday, April 2, 2010

Etherpad Open Source Installation Step-By-Step

Today I wanted to create a blog post documenting the steps necessary to create a Etherpad virtual machine in our organization.  This should work great for anyone else as well.  This article is a mix of instructions from Ubuntu documentations found here and here.  This Etherpad virtual machine was also built on VMware vSphere 4.0, so there are a couple of steps specific to that environment, but in previous testing, I know that the same process works just fine in VMware Fusion as well.

Virtual Machine Setup:

First thing to do is to create a new virtual machine and installing the OS.  We will be using Ubuntu 9.10 server and using the minimal virtual machine installation.  You can see in the picture below how you can get this installation option, it is under the modes section you can access by hitting F4.

Once you work through the installation of the OS which I won't go through here, you will be left with a very minimal Linux installation that we will then want to get brought up-to-date for the rest of the install.

Once you log in for the first time, you will want to make sure the system is up-to-date.  This is very important especially on ESX because there is a bug in the default Kernel that will not let you mount CD's which is necessary to install the VMware Tools.  The commands for doing this are below:

$ sudo apt-get update
$ sudo apt-get upgrade

This should get you the latest versions of everything installed by default.

You will then need to install three sets of packages that are required for the installation of VMware Tools.

$ sudo apt-get install build-essential linux-headers-$(uname -r) psmisc

Once these are installed, then you can ask VMware to install the tools, and you will complete the install by issuing the following steps.

$ mount /media/cdrom0
$ cd /tmp
$ tar xvzf /media/cdrom0/VMwareTools*.gz
$ sudo vmware-tools-distrib/ -d
$ rm -rf vmware-tools-distrib
$ umount /media/cdrom0

Once this has been done, I always install a couple of other packages to make it easier to administer the server.  These are optional, but I will keep them in the documentation in case you are interested.

$ sudo apt-get install openssh-server nano

This concludes the basic setup of the Virtual Machine.  Now we can move on to the specifics of setting up Etherpad on this machine.

Etherpad Installation:

The next thing we need to do for the process of install Etherpad is to install the dependencies that are required for this to run.  We will do that with the following command:

$ sudo apt-get install sun-java6-jdk scala mysql-server mysql-client libmysql-java mercurial

One thing to be careful of is that when you install the mysql server it is going to ask you for a password for the root user.  Make sure that you write this down or remember it so we can use it later in the process.

Next you will want to download the source code from Google.  I prefer to put all of this code in the /opt directory on your server, but I have been known to use the /tmp directory as well.

The following lines will get you all the source code necessary.

$ cd /opt
$ hg clone etherpad

You will then need to make some changes to this source code to get it to compile on Ubuntu, but I will try and simplify that as much as possible.

The first file you will need to modify is titled which can be found in /opt/etherpad/trunk/infrastructure/bin.  You will want to modify the file to make changes to two specific lines.  You can use the command below to open the file for editing.

$ sudo nano /opt/etherpad/trunk/infrastructure/bin/

On Line 35 of, you will want to change this:

JARFILES=`echo $SCALA_HOME/lib/scala-library.jar lib/*.jar lib/manifest`

Into this:

JARFILES=`echo $SCALA_HOME/scala-library.jar lib/*.jar lib/manifest`

Also, on line 39 you will want to change this:

$JAR xf $SCALA_HOME/lib/scala-library.jar

Into this:

$JAR xf $SCALA_HOME/scala-library.jar

You will see that in both cases you are strictly removing the /lib directory out of the path.

By using ctrl-o and ctrl-x in nano you will be able to save and close.

You will then need to add your server to /opt/etherpad/trunk/etherpad/src/etherpad/globals.js

$ sudo nano /opt/etherpad/trunk/etherpad/src/etherpad/globals.js

On line 30, you will want to add a couple of lines: (Of course changing and server.ip.address to match the name and ip address in your environment)

'': true,
'server.ip.address': true,

Again, ctrl-o ctrl-x to save your changes.  

You will now need to set a bunch of environment variables to make sure the code will compile correctly.

$ export JAVA_HOME=/usr/lib/jvm/java-6-sun
$ export JAVA="$JAVA_HOME/bin/java"
$ export SCALA_HOME=/usr/share/java    # or =/tmp – see above
$ export SCALA="$SCALA_HOME/bin/scala" # Shouldn’t it be =/usr/bin/scala ?
$ export PATH="$JAVA_HOME/bin:$SCALA_HOME/bin:$PATH"
$ export MYSQL_CONNECTOR_JAR=/usr/share/java/mysql-connector-java.jar

You have two more files to make changes to, and then we can run the compile and start the application.  For this modification, we need to make a couple of setup changes to the database script so that it will work correctly with your password you setup earlier.

$ sudo nano /opt/etherpad/trunk/etherpad/bin/

On line 22, add the following line:


Then on line 26, change:

echo "create database ${db};" | ${mysql} -u root

To this: (yourpass should be what you setup earlier)

echo "create database ${db};" | ${mysql} --user=root --password=yourpass

Also, change line 29 from this:

echo "grant all privileges on ${db}.* to 'etherpad'@'localhost' identified by 'password';" | ${mysql} -u root

To this: (again, yourpass should be what you setup earlier)

echo "grant all privileges on ${db}.* to 'etherpad'@'localhost' identified by 'password';" | ${mysql} --user=root --password=etherpad

Save the file with ctrl-o ctrl-x and then run it

$ cd /opt/etherpad/trunk/etherpad
$ sudo bin/

You will want to make one final change, and that is to change the default port to port 80 instead of port 9000 which is what is in the code by default.

$ sudo nano /opt/etherpad/trunk/etherpad/etc/

On line 11, change the listen port from 9000 to 80 so it looks like this:

listen = 80

Once you save the file, you can then build the application:

$ cd /opt/etherpad/trunk/etherpad
$ bin/

Once that completes, you can start the application:

$ bin/

That is it, if everything worked out correctly you should see the following screen:

Clicking on the big button will get you the interface you may have been accustomed to:

If you have any problems, or questions about this, please feel free to let me know.

Thursday, March 4, 2010

NCCE Presentation Slides

Below you will find the slides for our presentation later today on using Google Apps in our district.

Thursday, February 4, 2010

Google Apps Directory Sync - Specific Group/OU Selection

Over the past year people have asked me how they can go about deploying Google Apps in their organization, and how they can do it on a limited basis at first.  That answer is a bit more complex than I want to tackle today, but in the last few days I had a colleague in a local school district ask how he could deploy a few accounts while still using GADS.  That is something I will tackle today, if you would like to follow along, I would hope you have some experience (at least installing) Google Apps Directory Sync.

The situation here is the following, my colleague wanted to create a group in Active Directory, and then when specific users needed to have accounts in Google Apps, he would just drop them into there, and the next run of GADS will create the accounts in Google Apps.  I knew this could be done, but had never done it, so here without further ado is what is necessary.  After the break you will find the entire instructions for successfully setting this up.

Wednesday, January 20, 2010

Errors Moving Virtual Machines From Thick Provisioned To Thin Provisioned in Vsphere 4.0

So, as a part of my plan to try and blog more in 2010, and also to try and document more of what I am doing for my own reference as well, I present you with the following article...

Over the last couple of months I have been trying to come up with ways that we could reclaim some of the space on our Equallogic SAN that is quickly being used up. One of the obvious options is to move some of our virtual machines that were created in the ESX 3.5 days where the option to thin provision wasn't available to the new thin provisioned format supported in vSphere 4.0.

Before this week I had tried before to perform a storage vmotion to change from thick to thin provisioned but had always just tried to keep it on the same datastore. In listening to the VMware Communities Podcast over the past year I have caught onto many hints and tips that have lead me to new ideas, and this same thing happened about a week ago. They were discussing something about performing storage vmotions between datastores to change formats and I thought wow, I need to try that and see if it would work.

Of course this did exactly what I wanted, shrinking the actual usage of disk space on my SAN. This process is not without minor issues though, and that really is the purpose of this blog post. Once I had moved the machine from one datastore to another and changed to thin provisioned format, I was getting errors that would not allow the machine to be moved back to its original datastore:

These errors shown here: "A general system error occured: The virtual machine has virtual disk in link-cloned mode that prevents migration" lead me to find the following KB article at VMware which gives four options to solve the issue.

I took the path that seemed easiest to me, and that was to vmotion the machine to another host. Of course, as expected this solution solved the problem, and I was able to then migrate the machine back to its original datastore, but now in thin provisioned mode. All in all, I migrated 8 machines, and this resulted in a gain of approx. 700gb of usable disk space reclaimed which will definitely help us as we move forward in the future.

Friday, December 11, 2009

Google Groups Created Using GADS Not Working

Just wanted to post a quick note to anyone who is using the new Google Groups features in Google Apps. If you have previously created groups in your organization or you have groups that are created automatically with Google Apps Directory Sync like we do, they are not fully functional.

There is no fix at this time, but Google has recognized it is a problem:

We are really looking forward to this new feature and hope that it is soon fixed. This will add amazing functionality to all of our classrooms when working in Google Apps.

Sunday, June 28, 2009

Interesting Thoughts From Following NECC Virtually Today

Following up on yesterday's post about following conferences virtually without being there, I figured I would share some of the things I have seen today that may be interesting to others out there do the same thing as I am.

Here are a couple of hashtags that may be good to follow #notatnecc09 & #neccunplugged. NECC Unplugged is starting tomorrow, and is more of an unconference existing inside the main conference and will be broadcasting all their sessions through Elluminate.

Here's a live blog of Malcolm Gladwell's opening Keynote speech.

Site doing a great job of cataloging what is going on online at NECC for those of us unfortunate enough not to be there.

Like yesterday, I found some interesting quotes via Twitter I would like to share, I have left out all of the Gladwell quotes, as you should be able to find those in any of the coverage of his keynote, but here are some of the others:

#necc09 #necc #iste for that matter, as meaningful learning moves online, will classrooms be only for those too skillless to escape class? @AndrewBWatt

The illiterate of the 21st c'y are not those who can't read or write, but those who can't learn, unlearn and relearn #NECC09 @ISTEGlobal

Reading: "Utah University Lifts Ban on YouTube" Cites educational content. Shocking! If Brigham Young can do it... @willrich45

Huge indictment of investment in IWBs instead of netbooks -- teacher-centered decision, not student-centered one #CCDC09 @wsstephens

if most students soon will have data access through their own devices and schools can't filter, how will schools react? #necc09 @mhines

#necc #neccunplugged "Technology has transformed our lives except in our schools" @oysteinj

Stager said student use of computers is often superficial. After all, getting images off digital camera should be a baseline skill #CCDC09 @wsstephens

Being able to get the computer to do something that it already doesn't do is a critical life skill. #ccdc09 @lnitsche

I'll try and keep this up for the rest of the conference, but with having to go back to work tomorrow, it may make it a bit harder.

Saturday, June 27, 2009

Following Conferences Virtually Is Like Drinking From a Firehose

So this year I am unable to attend NECC or any other conferences out of state due to budget reductions occurring in our district. I was even accepted to speak again this year, but had to decline. Anyway enough of my back story.

So this year I am attempting to follow what is going on at NECC through Twitter and blogs that I currently read. And much like other in-person events I have attempted to follow virtually (WWDC & Google I/O), the amount of information coming out of these events is overwhelming.

But with that being said, I did have some free time to follow what is going on, and since the conference hasn't fully kicked off, it was possible to find some really interesting and thought provoking tweets from today that I think should really be seen by a greater audience. Here are some of those:

There shouldn't be an Acceptable Use Policy, you should have a RESPONSIBLE Use Policy. -someone at my session. @imcguy

Don't call it Social Networking, it's Educational Networking - Doug Johnson.

@ittosde @imcguy I want districts to have an Empowered Use Policy. =) You, as a student/employee, have the right to be empowered to... @mcleod

Re: web filtering... "we know some kids will drink on prom night- we don't fix it by closing down prom" ~ @mcleod

We spend so much time teaching appropriate use. We need to teach EMPOWERED use as well. @bethstill

How about if we teach CTS computer programming by having kids learn to program iTouch apps. Bet that would engage students!! @kaminskiterry

As I try and keep up on this knowledge deluge the next few days, I will try and post some of the more interesting things here Tweet about them

Thursday, May 28, 2009

Google Web Elements

Yesterday at Google I/O, their developers conference, Google Debuted a new product that could help people simplify publishing of Google Apps generated content. They have created simple widgets that you fill in your information about the content, and they give you the simple javascript code to insert it into your own web pages, blogs, etc. A simple example is a widget they have for simply publishing presentations created in Google Apps. You can see the slides from our ACPE presentation below:

It took a grand total of about 20 seconds to paste in the url of the presentation, and then copy the javascript for inclusion in this blog post. Can't get much easier than that. You can find more information at

Monday, May 25, 2009

Upgrading our VMware Infrastructure to vSphere 4

This week VMware released their major upgrade to the VMware Infrastructure. In case you haven't seen anything about it, you can read more at There are some really cool new features in this new release, and there are also some significant performance gains that could be realized with an upgrade to vSphere 4.

Since I listen to a lot of podcasts regarding VMware and having been hearing about the release for months, I having been waiting on this upgrade for a while now. Also, since we are not quite in the production stages of our VMware implementation I figured that an upgrade the first day that the bits are released to the public would be an acceptable risk.

I am happy to say that the upgrade went fairly well, our vCenter and ESX hosts are all upgraded as well as the virtual machines residing on them. I am still running into some glitches with Converter Enterprise and Consolidation Manager, but those will be worked out in the next few days. The installation process is really a fairly simple one, especially if you go through the upgrade center on the VMware site and watch the videos. I had already watched them once, but I used them to following along to during my upgrade process, and everything really went well. Thanks for that VMware, maybe an idea for some other vendors out there when it comes to big releases and upgrades that all your users are facing.