Trial #40: Populate Active Directory with iSAMS Pupil Data
Problem:
If you work at a school using iSAMS, it is probably your trusted data source for pupil info such as preferred name. But who maintains AD to make sure changes propagate to your Global Address List
?
Solution:
PowerShell makes the management of Active Directory very easy using the ActiveDirectory Module.
I have published a client and PowerShell Module the the iSAMS Batch API.
This can be installed from the PowerShell Gallery:
We can use these modules to acquire the data and and make changes to Active Directory.
Acquiring the Pupil Data
The simplest way to get the data is using an API Key
However, this authentication method will be phased out in the future and you will need to Connect using OATH
Matching with Active Directory
In our environment, the iSAMS property SchoolCode
matches the AD property SamAccountName
which is also a valid -Identity
property of the Get-ADUser
.
Therefore we can iterate over our pupils and attempt to get our AD users like this.
However, the iSAMS property SchoolCode
is not a perfect primary key - there is no guarantee of uniqueness and it might change throughout a pupils school career. Therefore, I prefer to use the iSAMS properties Id
and SchoolId
which I write into the AD properties EmployeeID
and EmployeeNumber
.
Example Script
You may be able to use the following script as a starting point for your own environment.
I store restricted information in a config file using a method I describe in my next post
The following will persist details with at least some obfuscation to file.
The following script loads this information so it need not be input manually every time it is run. It will prompt for user confirmation when a new match between AD and iSAMS is found before writing the iSAMS primary key to the AD user. AD Users with a matching iSAMS ID will have other properties updated to match iSAMS as required. Furthermore, a set of pupils that may need to be created in AD are collected in the variable $isamsUsersToCreate
.
Leave a comment