Occasional Contributor

Hello there,


I'm not great with Powershell, and I've been trying to take my CSV of grad emails, and block the sign in, and remove the A3/A1 for student use licenses from the uses. 


Is there a available script that I can use to do this, i cant seem to find one that works. 

Hi @MarcW64 


I have nothing to hand, but I've butchered a script I used last year to remove and readd licences for a bunch of students.


It should work, but try it on a single user to start off with.



$students = import-csv "C:\support\student_disable.csv" -delimiter ","
foreach ($student in $students)

    Set-MsolUserLicense -ObjectID $ObjectID -RemoveLicenses $sku -Verbose
    Set-MsolUser -ObjectID $ObjectID  -BlockCredential $true    




The csv looks like this:




If your csv has upn rather than ObjectID, then you can use the -UserPrincipalName switch instead of -objectid


Use Get-MsolAccountSku to get the correct licence name for your tenant. 


Hope this helps,