diff --git a/plugins/cas_auth_unl/.gitignore b/plugins/cas_auth_unl/.gitignore
index 5657f6ea7d574e423dc2c297e2e19a9dbd7a7170..9e31f03a6926ea43a177d65a4ff6c99a14013de5 100644
--- a/plugins/cas_auth_unl/.gitignore
+++ b/plugins/cas_auth_unl/.gitignore
@@ -1 +1,2 @@
-vendor
\ No newline at end of file
+vendor
+migration.lock
\ No newline at end of file
diff --git a/plugins/cas_auth_unl/migration.php b/plugins/cas_auth_unl/migration.php
new file mode 100644
index 0000000000000000000000000000000000000000..ab9b8ae390ab298c9f7c6e395b5db44da8461128
--- /dev/null
+++ b/plugins/cas_auth_unl/migration.php
@@ -0,0 +1,90 @@
+<?php
+require_once __DIR__ . '/../../elgg/vendor/autoload.php';
+
+\Elgg\Application::start();
+
+$lock_file = __DIR__ . '/migration.lock';
+
+$lock = @file_get_contents($lock_file);
+if (!$lock) {
+    $lock = 0;
+}
+
+if (!$users = @file_get_contents('http://planetred.unl.edu/sync.php?start='.$lock)) {
+    echo 'FAILED TO CONNECT' . PHP_EOL;
+    exit();
+}
+
+$users = json_decode($users, true);
+
+if (!$users) {
+    echo 'FAILED TO DECODE' . PHP_EOL;
+    exit();
+}
+
+//Copy over avatar stuffs
+$context = stream_context_create(
+    array(
+        'http' => array(
+            'follow_location' => false
+        )
+    )
+);
+
+$icon_sizes = array('master', 'large', 'medium', 'small', 'tiny', 'topbar');
+
+foreach ($users as $source_user) {
+    if (0 !== stripos($source_user['username'], 'unl_')) {
+        //Not a UNL authenticated user
+        continue;
+    }
+
+    $target_user = get_user_by_username($source_user['username']);
+    
+    if (!$target_user) {
+        //create user
+        echo 'creating user: ' . $source_user['username'] . PHP_EOL;
+
+        $password = generate_random_cleartext_password();
+
+        try {
+            $target_guid = register_user($source_user['username'], $password, $source_user['name'], $source_user['email'], false);
+        } catch (RegistrationException $e) {
+            echo "\t Unable to create user: " . $e->getMessage() . PHP_EOL;
+            continue;
+        }
+        
+        $target_user = get_user($user_guid);
+    }
+    
+    foreach ($icon_sizes as $size) {
+        if (!$icon = @file_get_contents('http://planetred.unl.edu/pg/icon/'.$source_user['username'].'/'.$size, false, $context)) {
+            //No icon was found, skip.
+            echo 'SKIP' . PHP_EOL;
+            continue;
+        }
+        
+        echo 'Creating ' . $size . ' icon for ' . $source_user['username'] . PHP_EOL;
+
+        $file = new ElggFile();
+        $file->owner_guid = $target_user->guid;
+        $file->setFilename("profile/{$target_user->guid}{$size}.jpg");
+        $file->open('write');
+        $file->write($icon);
+        $file->close();
+        
+        //Don't overload the server
+        usleep(500000);
+    }
+
+    // reset crop coordinates
+    $target_user->x1 = 0;
+    $target_user->x2 = 0;
+    $target_user->y1 = 0;
+    $target_user->y2 = 0;
+
+    $target_user->icontime = time();
+    
+    //Update the lock file
+    file_put_contents($lock_file, $source_user['guid']);
+}