UMRA - Query your live@edu environment faster and more efficient
May 11th, 2011 / Send feedback » / by admin
Tools4ever Solutions
(UMRA) - User Management Resource Administrator: Download
(ESSOM) - Enterprise Single Sign-On Manager: Download
(SSRPM) - Self Service Reset Password Management: Download
Test Environment:
Server - Server 2008 R2
UMRA - 10.5 (build 1638)
If you haven't already, make sure you go read my blog post on setting up a UMRA project to connect to your live @ edu environment. http://umrahelp.com/blog1.php/2011/03/10/how-to-connect-umra-to-your-live-edu-enviorment
During some of my recent live@edu student automation projects, I've learned a few tricks to speed up data pulls from your live@edu environment with powershell or UMRA. Now you might be asking yourself why you would want to pull data faster? Well, live@edu limits how many users you can pull back at one time, so for example if you have a live@edu environment with 10k users, you will only be able to pull accounts back in small blocks around 2000 or so. Now, with that said you run into the problem of, how do you keep track of who you have pulled back and you have not pulled back already, well the method I will use is creating a SQL table with the letters A-Z, then loop through each of those letters and pull them with a filter like "mail -like '(your_letter)*'".
Most live@edu implementations you will also need to have some type of "anchor" between the accounts in Active Directory, and your live@edu accounts. Sometimes you can use the actual email as the anchor, however using one of the live@edu attributes is another preferred method. Most of the time we will use a customattribute to store the EmployeeID, or StudentID from the HR or SIS system. This is a preferred method to ensure a permanent anchor between both the Active Directory account, and the live@edu account. Now, as you might know the customattribute field is stored in the "MailBox User" object, compared to the standard user data is stored in "User". So if you do the poweshell command below, you will notice you are unable to pull back the customattribute field.
Powershell Command -
Get-User -ResultSize Unlimited | windowsemailaddress -like '*your_user*'
You will also notice if you run the below powershell command on the "Mailbox" object, you will be unable to get some of the data stored in the "User" object side.
Powershell Command -
Get-Mailbox -ResultSize Unlimited | windowsemailaddress -like '*your_user*'
So how do you get around having to run 2 powershell queries to get a complete set of data you need from a user? Well you can write a powershell script like below. Let me explain what the script is doing first. First we do a filter on live@edu users "User" object to get a set of users who meet your filter criteria. Next, we loop through those the live@edu set of users, and grab any attributes needed on the "Mailbox" object side.
Powershell Command -
Get-User -ResultSize Unlimited | Where { $_.RecipientType -eq 'UserMailbox' -and $_.windowsemailaddress -like '*student*' } | ForEach { $Users = @{} } { $Users[$_.SamAccountName] = $_ }
Get-Mailbox -ResultSize Unlimited | Where { $Users[$_.SamAccountName].Title -like '*student*' } |
ForEach {
New-Object psobject |
Add-Member -PassThru NoteProperty Alias $_.Alias |
Add-Member -PassThru NoteProperty FirstName $Users[$_.SamAccountName].FirstName |
Add-Member -PassThru NoteProperty LastName $Users[$_.SamAccountName].LastName |
Add-Member -PassThru NoteProperty windowsemailaddress $Users[$_.SamAccountName].windowsemailaddress |
Add-Member -PassThru NoteProperty CustomAttribute1 $_.CustomAttribute1 |
}
}
With the command above you can now access both "User" and "Mailbox" objects with just one powershell call. If you want to add additional attributes to the statement, just add another "Add-Member" option with your specific criteria to the powershell statement. Overall, the powershell method above is a quicker and more efficient way to pull data from your live@edu enviroment without having to run multiple powershell commands to get a users set of data.
Feedback awaiting moderation
This post has 22 feedbacks awaiting moderation...

