Disable Yammer License in Office 365 Education

Standard

A few weeks ago I wrote a blog post about changing licenses from the Office 365 Education license to the Office 365 Plus Education license.  This PowerShell script will help you to make these changes.

In the last week, further integration of Yammer and Office 365 has accord where we can now disable the Yammer license.

I’ve had many customers ask if there was a way we could just allow teachers and admin staff access to Yammer and we haven’t been able to do that until now.

Below are a set of script that will help you to either remove the Yammer license from all users (doesn’t matter what license they have been assigned), keep the current options they have enabled and then removes the yammer option.  The second script will just remove it from users who have a student license.

Remove Yammer license from all users

#$users = Get-MsolUser -MaxResults 10000 | Select-Object -property UserPrincipalName -ExpandProperty Licenses
foreach ($user in $users){

    $UPN = $user.userprincipalname
    $useraccount = get-msoluser -UserPrincipalName $UPN
    $licensetype = $useraccount.Licenses.accountskuid
    $licensesassigned = $useraccount.Licenses.servicestatus


write-host ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
write-host ~~~~ Now Starting on $UPN ~~~~
write-host "The following licenses are disabled on this account"
                $disabledPlans= @()
        foreach ($line in $licensesassigned) {
                if ($line.ServicePlan.ServiceName -eq "SWAY" -and $line.ProvisioningStatus -eq "Disabled") {Write-Host $line.ServicePlan.ServiceName "Disabled" -BackgroundColor DarkRed}
                if ($line.ServicePlan.ServiceName -eq "SHAREPOINTWAC_EDU" -and $line.ProvisioningStatus -eq "Disabled") {Write-Host $line.ServicePlan.ServiceName "Disabled" -BackgroundColor DarkRed}
                if ($line.ServicePlan.ServiceName -eq "MCOSTANDARD" -and $line.ProvisioningStatus -eq "Disabled") {Write-Host $line.ServicePlan.ServiceName "Disabled" -BackgroundColor DarkRed}
                if ($line.ServicePlan.ServiceName -eq "SHAREPOINTSTANDARD_EDU" -and $line.ProvisioningStatus -eq "Disabled") {Write-Host $line.ServicePlan.ServiceName "Disabled" -BackgroundColor DarkRed}
                if ($line.ServicePlan.ServiceName -eq "EXCHANGE_S_STANDARD" -and $line.ProvisioningStatus -eq "Disabled") {Write-Host $line.ServicePlan.ServiceName "Disabled" -BackgroundColor DarkRed}
                ###############################################

                if ($line.ServicePlan.ServiceName -eq "YAMMER_EDU") { $disabledPlans +="YAMMER_EDU"}
                if ($line.ServicePlan.ServiceName -eq "SWAY" -and $line.ProvisioningStatus -eq "Disabled") { $disabledPlans +="SWAY"}
                if ($line.ServicePlan.ServiceName -eq "SHAREPOINTWAC_EDU" -and $line.ProvisioningStatus -eq "Disabled") { $disabledPlans +="SHAREPOINTWAC_EDU"}
                if ($line.ServicePlan.ServiceName -eq "MCOSTANDARD" -and $line.ProvisioningStatus -eq "Disabled") { $disabledPlans +="MCOSTANDARD"}
                if ($line.ServicePlan.ServiceName -eq "SHAREPOINTSTANDARD_EDU" -and $line.ProvisioningStatus -eq "Disabled") { $disabledPlans +="SHAREPOINTSTANDARD_EDU"}
                if ($line.ServicePlan.ServiceName -eq "EXCHANGE_S_STANDARD" -and $line.ProvisioningStatus -eq "Disabled")  {$disabledPlans +="EXCHANGE_S_STANDARD"}

        }


    Set-MsolUserLicense -UserPrincipalName $UPN -RemoveLicenses $licensetype
        $License = New-MsolLicenseOptions -AccountSkuId $licensetype -DisabledPlans $disabledPlans;
 $info = Set-MsolUserLicense -UserPrincipalName $UPN -AddLicenses $licensetype -LicenseOptions $License

  write-host "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
    write-host ""
    
}

 

Remove Yammer from Student assigned accounts only

$users = Get-MsolUser -MaxResults 10000 | Select-Object -property UserPrincipalName -ExpandProperty Licenses
foreach ($user in $users){

    $UPN = $user.UserPrincipalName
    $useraccount = get-msoluser -UserPrincipalName $UPN
    $licensetype = $useraccount.Licenses.accountskuid
    $licensesassigned = $useraccount.Licenses.servicestatus

write-host ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
write-host ~~~~ Now Starting on $UPN ~~~~
write-host "The following licenses are disabled on this account"
                $disabledPlans= @()
        foreach ($line in $licensesassigned) {
                if ($line.ServicePlan.ServiceName -eq "SWAY" -and $line.ProvisioningStatus -eq "Disabled") {Write-Host $line.ServicePlan.ServiceName "Disabled" -BackgroundColor DarkRed}
                if ($line.ServicePlan.ServiceName -eq "SHAREPOINTWAC_EDU" -and $line.ProvisioningStatus -eq "Disabled") {Write-Host $line.ServicePlan.ServiceName "Disabled" -BackgroundColor DarkRed}
                if ($line.ServicePlan.ServiceName -eq "MCOSTANDARD" -and $line.ProvisioningStatus -eq "Disabled") {Write-Host $line.ServicePlan.ServiceName "Disabled" -BackgroundColor DarkRed}
                if ($line.ServicePlan.ServiceName -eq "SHAREPOINTSTANDARD_EDU" -and $line.ProvisioningStatus -eq "Disabled") {Write-Host $line.ServicePlan.ServiceName "Disabled" -BackgroundColor DarkRed}
                if ($line.ServicePlan.ServiceName -eq "EXCHANGE_S_STANDARD" -and $line.ProvisioningStatus -eq "Disabled") {Write-Host $line.ServicePlan.ServiceName "Disabled" -BackgroundColor DarkRed}
                ###############################################


                if ($line.ServicePlan.ServiceName -eq "SWAY" -and $line.ProvisioningStatus -eq "Disabled") { $disabledPlans +="SWAY"}
                if ($line.ServicePlan.ServiceName -eq "SHAREPOINTWAC_EDU" -and $line.ProvisioningStatus -eq "Disabled") { $disabledPlans +="SHAREPOINTWAC_EDU"}
                if ($line.ServicePlan.ServiceName -eq "MCOSTANDARD" -and $line.ProvisioningStatus -eq "Disabled") { $disabledPlans +="MCOSTANDARD"}
                if ($line.ServicePlan.ServiceName -eq "SHAREPOINTSTANDARD_EDU" -and $line.ProvisioningStatus -eq "Disabled") { $disabledPlans +="SHAREPOINTSTANDARD_EDU"}
                if ($line.ServicePlan.ServiceName -eq "EXCHANGE_S_STANDARD" -and $line.ProvisioningStatus -eq "Disabled")  {$disabledPlans +="EXCHANGE_S_STANDARD"}

        }

    Set-MsolUserLicense -UserPrincipalName $UPN -RemoveLicenses $licensetype

    if ($licensetype -like "*STUDENT*"){
            write-host "This user has a student license"
            $FullFrictionFreeLicense = Get-MsolAccountSku | Where-Object {$_.AccountSKUID -like "*STANDARDWOFFPACK_IW_STUDENT*"}
                                            }
    
    if ($licensetype -like "*FACULTY*") {
            write-host "This user has a faculty license"
            $FullFrictionFreeLicense = Get-MsolAccountSku | Where-Object {$_.AccountSKUID -like "*STANDARDWOFFPACK_IW_FACULTY*"}
                                            }
        
    $License = New-MsolLicenseOptions -AccountSkuId $FullFrictionFreeLicense.AccountSkuId -DisabledPlans $disabledPlans;
 $info = Set-MsolUserLicense -UserPrincipalName $UPN -AddLicenses $FullFrictionFreeLicense.AccountSkuId -LicenseOptions $License
  
  ###test

      $testuseraccount = get-msoluser -UserPrincipalName $UPN
    $testlicensetype = $useraccount.Licenses.accountskuid

    if ($testlicensetype -like "*STANDARDWOFFPACK_IW*") { write-host "Success" -BackgroundColor DarkGreen} ELSE {write-host "FAILED" -BackgroundColor Red}

  
    write-host "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
    write-host ""
}

 

5 thoughts on “Disable Yammer License in Office 365 Education

  1. If they are interested in giving students access, Gaggle offers a student monitoring and safety service for Yammer. We have lots of customers on office 365, but very few K-12 schools are using Yammer so far.

  2. Jamie

    This didn’t work for me. All it did was remove the mailbox of some staff users. It’s actually created more work if anything 🙁

  3. Pingback: Office 365 Yammer
  4. Jack Lawless

    As far as I can tell this is just disabling functions other than Yammer, can you confirm on your second script? I began running it but have concerns it’s not doing what it’s meant to.

Leave a Reply

Your email address will not be published. Required fields are marked *