This PHP script assumes you have used the jUpgrade or SP Upgrade tool or similar to migrate from 1.5 to 2.5/3.x to preserve user ids.
Please note that the database user for the Joomla 2.5/3.x site will need read access to the Joomla 1.5 site's database - so if your Joomla 2.5x3.x uses a different database to your Joomla 1.5 site you may need to check your database permissions.
NOTE: it's a good idea to install JEvents via the Joomla! Extension manager once the migration is finished, this will just make sure all the tables are installed and setup correctly.
Let us know how you get on in the forums.