Jump to content

Active User Manager equivalent - Promote Students


Recommended Posts

Posted

That time of year again.

 

I need to promote all students up a year to the correct OU in AD and move their docs and change their home folder paths. Usually Active User Manager (AUM) could do all this as the variables were all stored on the particular OU however, it doesn't seem to work in Server 2012R2 and the software is no longer developed.

 

Anyone have any ideas? how do you do it?

 

Our OU structure is like this

 

School 1 >> Users >> Students >> Year1

School 1 >> Users >> Students >> Year 2 etc etc etc

School 2 >> Users >> Students >> Year 1

School 2 >> Users >> Students >> Year 2 etc etc etc

 

4 schools in total. All years need to be promoted into the year's above OU. Each year has a homefolder path relating to that year so that needs promoting also and contents being moved to correct year's share.

 

Any help or pointers would be appreciated.

Posted
Any reason why you don't just have a 'Year Of Intake' OU? That way you wouldn't have to do promotion each year?

 

A valid point, its always been easier to group and sort with year numbers..................... could look to change that.

Posted
Yeah used that at old school. Going to look at it for both our secondaries but need to do this for our primaries and won't get that though soon enough!
Posted (edited)

I'll dig up my script that I've got lying around when I get into work. Should be easy enough assuming you've got a leavers OU or similar (to move the year 6 pupils to).

 

Edit: After a bit of digging and playing around in the command line I'd probably try to do something like this (modify the OU path to match what you have):

 

$OUs = Get-ADOrganizationalUnit -filter * -searchbase "OU=Students,OU=Users,DC=Domain,DC=Local" | Where {$_.Name -match "Year"}

Foreach ($OU in $OUs) {

$Users = Get-ADUser -filter * -searchbase $OU.DistinguishedName -properties Office

$Users | Foreach { if ($_.Office -eq $OU.Name -or $_.office -eq $null) {Set-ADUser -identity $_.SamaccountName -Office "Year$([int]$OU.name.Substring(4) + 1)" -whatif}}

$Users = Get-ADUser -filter * -searchbase $OU.DistinguishedName -properties office,homedirectory

if (($OU.Name -eq "Year6" -and $Users[0].Office -eq "Year7") -or ($OU.Name -eq "Year11" -$Users[0].Office -eq "Year12") 
{
$users | foreach { Move-ADObject -identity $_.Distinguishedname -TargetPath "OU=Leavers,OU=Students,OU=Users,DC=Domain,DC=Local" -whatif }
New-item  -path "\\server\studentshare\leavers\" -name "Year" -itemtype Directory -WhatIf
$users | foreach { Move-item -path $_.HomeDirectory -destination "\\server\studentshare\leavers\year" -whatif; Set-ADUser -identity $_.Samaccountname -homedirectory "\\server\studentshare\leavers\year\$($_.samaccountname)" -whatif}
}
elseif ($OU.Name -ne $Users[0].Office)
{
$users | foreach { Move-ADObject -identity $_.Distinguishedname -TargetPath "OU=$($_.Office),OU=Students,OU=Users,DC=Domain,DC=Local" -whatif }
$users | foreach { Move-item -path $_.HomeDirectory -destination "\\server\studentshare\$($_.Office)"; Set-ADUser -identity $_.Samaccountname -homedirectory "\\server\studentshare\$($_.Office)\$($_.samaccountname)" -whatif}
}
}

 

I've got -whatif on the end of each command so you can run it and make sure it will actually do what you want. It's a little more complicated that it probably needs to be but that's to ensure that regardless of what order it runs in then it will hopefully only move the correct students up a group, the last thing anyone wants is all their student accounts in one OU and having to unpick which OU they should be in.

Edited by halbaradkenafin
Posted
Intake 2015, Intake 2016 etc is the easiest way to manage users in my opinion - the only "headache" is that for us when new sixth formers arrive from other schools to remember to add them into the intake that they would have been if they had started her in year 7.
Posted
Intake 2015, Intake 2016 etc is the easiest way to manage users in my opinion - the only "headache" is that for us when new sixth formers arrive from other schools to remember to add them into the intake that they would have been if they had started her in year 7.

Yes, I've fallen foul of that a couple of times!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...