This is a set of commands to make the headache of managing Hodder Education's "Dynamic Learning" platform user accounts easier with regards to class memberships and student details
- Imports users with groups into easy-to-modify powershell objects (as a class) (
$list = Import-csv export_with_groups.csv | Convertto-DLUser
) - Create new users from scratch or AD account (from
get-aduser -properties emailaddress | New-DLUser
) with the username set to the email, avoiding password management.- An example might be
$new = ...as above
and make a new full list to work with$all = $new + $list
- An example might be
- Bulk remove group memberships on the user list (
$list.removeGroup('example')
) - Bulk add group membership on the whole list (
$list.addgroup('example)
) or a subest (($list | where username -like 18*).addGroup('Example')
) - Automatically assign group memberships form matching AD Group Names (
Update-DLGroup -Users $List -group AD_Name1, AD_Name2
) see also: School Groups - Bulk disable user access to DL (
($list | where xyz).Disable()
) - Create CSV Files ready to upload in their specific format and advice
You can bulk delete users from DL (($list | where xyz).Delete()
) but They have disabled this feature from the CSV import menu, so this can at least help you format a CSV to send them. It will warn you if users aren't disabled before they're deleted.
New class methods example;
# Import the data sheet
$allUsers = Import-CSV 'N:\downloads\Accounts.csv' | ConvertTo-DLUser
# Show the users and groups to yourself
$allUsers | format-table username,memberOf
# Empty the year 10 group of everyone
$allUsers.removeGroup('Year 10')
# Set the correct intake year to the new year 10
($allUsers | where-object username -like 16*).addGroup('Year 10')
# Set members of 5 classes
Update-DLGroup -user $allUsers -group '7HF_Cs','7JAC_Cs','7LH_Cs','7GMB_Cs','7CW_Cs'
#Create a CSV(s) of only the changed users
$all | where-object action | New-DLCSV
When making new users this won't bother adding data DL doesn't need to know therefore help to prevent data loss. This being Dob, UPN, gender.
- Import the users with groups from a DL CSV (this sets the available groups) from import-user
- Once the users are imported, it will have an accurate list of group names to validate future commands against.
- Add new students from AD piping to new-userclass
- Combine the lists e.g.
$all = $importedUsers + $newUsers
- Update the year groups removegroup/ filter and call addgroup
- update the class groups
Update-DLGroupMembershipFromAD
- export modified users and upload each file.
The Dynamic learning upload works most reliabled around a 250 user limit in the CSVs
- Adds an empty group header to the csv or
- Adds a property of a group name to a user account, can then be piped to a csv
Re-write the DL exported CSV with sensible column headers
Lists all groups found on the imported CSV
Clear the users groups and re-assign "Yes" to their class and year group.
Creates new account object with a more usable set of property names;
Action :
ID : 000000
Type : S
UserName : StudentAccont
Password : abcd
Title :
Firstname : Fisrtname
Middlename :
Lastname : Surname
DOB : 01/01/1970
Sex :
UPN : -blank-
email : Student@example.com
memberOf : {7M5_Cs, Year 7}
$user.delete()
sets the Action property to 'D'
$user.export()
export does a number of things to prepare for creating a CSV to import back to Dynamic Learning
- Re-format all property names to the pattern as desired by their template
- Append properties of all the possible group memberships in order to negate previous values
- Update the group memberships to account for the membersOf property
Simply a wrapper to the .export()
method described above.
Update-User
should have test-user split off to remove compare-object output so it can be used to pipe further- Finalize
New-DLUser
from reference.ps1 to be called inupdate-DLUser
for adding new AD users to Dynamic learning to then have proper group assignment