In a lot of cases you need to assign, remove or select which services in a license to assign to all of your users in one shot. Thru the UI it is a huge amount of work, consider environments with more than 5k users, which can easily be automated with Powershell.

In order to assign, remove and select which services to assign to all your users, you can use the script here-under.

First replace [tenantname] with the name of your tenant. You can look it up by navigating to SharePoint Online and copy paste the piece between “https://” and “.sharepoint.com”.

Beware that this script has been designed to work with E3 licenses. If you or your organisation are using a different type of license, mind changing it in the script first.

function showMenu
{ 
	do{
		cls
		Write-Host "================ Office 365 Management Shell ================"
     
		Write-Host "1: Assign Office 365 Enterprise E3 license to ALL users"
		Write-Host "2: Remove Office 365 Enterprise E3 license from ALL users"
		Write-Host "3: Set services in E3 license for ALL users"
		Write-Host "Q: Press 'Q' to quit."
		 
		$input = Read-Host "Please make a selection"
		switch ($input) {
			'1' {
				cls
				assignLicense
			} '2' {
				cls
				removeLicense
			} '3' {
				cls
				setServices
			} 'q' {
				cls
				return
			}
			'Q' {
				cls
				return
			}
		 }
		 pause
	}
	until ($input -eq 'q' -or $input -eq 'Q')
}

function assignLicense{
	param(
        $license = "[tenantname]:ENTERPRISEPACK"
	)
	
	Write-Host "Assigning licenses to all users" -foregroundcolor Yellow
	Write-host "Press enter to start, Q+enter to return to menu"
	
	$input = Read-Host
	if($input -eq "q" -or $input -eq 'Q'){
		showMenu
	}
	
	Start-Transcript -Path (".\Office365.AssignLicenses.{0}.log.txt" -f ((Get-Date).ToString("yyyyMMddHHmmss"))) -NoClobber
	
	$allUsers = Get-MsolUser -All | where {$_.BlockCredential -eq $false -and $_.UserType -ne "Guest" -and $_.isLicensed -eq $false}
	$allUsers | ForEach-Object {
		$upn = $_.UserPrincipalName
		
		Try{
			Set-MsolUserLicense -UserPrincipalName $upn -AddLicenses $license
			Write-Host "License set for user" $upn -foregroundcolor Green
		}
		Catch{
			Write-Host "Error setting license for user ${$upn}: ${$_.Exception.Message}" -foregroundcolor Red
		}
	}
	
	Write-Host "Assigning licenses to all users done" -foregroundcolor Green
	Stop-Transcript
	Write-Host "Press enter to continue"
	Read-Host
	showMenu
}

function removeLicense{
	param(
        $license = "[tenantname]:ENTERPRISEPACK"
	)
	
	Write-Host "Removing licenses from all users" -foregroundcolor Yellow
	Write-host "Press enter to start, Q+enter to return to menu"
	
	$input = Read-Host
	if($input -eq "q" -or $input -eq 'Q'){
		showMenu
	}
	
	Start-Transcript -Path (".\Office365.RemoveLicenses.{0}.log.txt" -f ((Get-Date).ToString("yyyyMMddHHmmss"))) -NoClobber
	
	$allUsers = Get-MsolUser -All | where {$_.BlockCredential -eq $false -and $_.UserType -ne "Guest" -and $_.isLicensed -eq $true -and $_.licenses[0].AccountSku.SkuPartNumber -eq ($license).Substring($license.IndexOf(":")+1, $license.Length-$license.IndexOf(":")-1)}
	$allUsers | ForEach-Object {
		$upn = $_.UserPrincipalName
		
		Try{
			Set-MsolUserLicense -UserPrincipalName $upn -RemoveLicenses $license
			Write-Host "License removed for user" $upn -foregroundcolor Green
		}
		Catch{
			Write-Host "Error removing license for user ${$upn}: ${$_.Exception.Message}" -foregroundcolor Red
		}
	}
	
	Write-Host "Removing licenses from all users done" -foregroundcolor Green
	Stop-Transcript
	Write-Host "Press enter to continue"
	Read-Host
	showMenu
}

function setServices{
	param(
        $license = "[tenantname]:ENTERPRISEPACK"
	)
	
	Write-Host "Assign services to E3 licenses to all users" -foregroundcolor Yellow
	Write-host "Press enter to start, Q+enter to return to menu"
	
	$input = Read-Host
	if($input -eq "q" -or $input -eq 'Q'){
		showMenu
	}
	
	Start-Transcript -Path (".\Office365.SetServices.{0}.log.txt" -f ((Get-Date).ToString("yyyyMMddHHmmss"))) -NoClobber
	
	Write-Host "Provide a comma-separated list of services that need to be disabled, without spaces."
	Write-Host "For example: 'YAMMER,Deskless,SWAY' will disable Yammer, Staffhub and Sway"
	Write-host "In case every service needs to be enabled, leave blank."
	Write-Host ""
	Write-Host "Use the following names for the services:"
	$services = @(
		@{Service = "Azure Rights Management (RMS)"; Code = "RMS_S_ENTERPRISE"},
		@{Service = "Exchange Online Plan 2"; Code = "EXCHANGE_S_ENTERPRISE"},
		@{Service = "Flow"; Code = "FLOW_O365_P2"},
		@{Service = "Forms"; Code = "FORMS_PLAN_E3"},
		@{Service = "Mobile Device Management"; Code = "INTUNE_O365"},
		@{Service = "Office Professional Plus"; Code = "OFFICESUBSCRIPTION"},
		@{Service = "Office Online"; Code = "SHAREPOINTWAC"},
		@{Service = "Planner"; Code = "PROJECTWORKMANAGEMENT"},
		@{Service = "Powerapps"; Code = "POWERAPPS_O365_P2"},
		@{Service = "SharePoint Online"; Code = "SHAREPOINTENTERPRISE"},
		@{Service = "Skype for Business Online"; Code = "MCOSTANDARD"},
		@{Service = "Staffhub"; Code = "Deskless"},
		@{Service = "Stream"; Code = "STREAM_O365_E3"},
		@{Service = "Sway"; Code = "SWAY"},
		@{Service = "Teams"; Code = "TEAMS1"},
		@{Service = "Todo"; Code = "BPOS_S_TODO_2"},
		@{Service = "Yammer"; Code = "YAMMER_ENTERPRISE"}
	) | % { New-Object object | Add-Member -NotePropertyMembers $_ -PassThru }	
	$services | format-table	
	$disabledServices = Read-Host "Disabled services"
	
	if($disabledServices -eq ""){
		$LicenseOptions = New-MsolLicenseOptions -AccountSkuId $license -DisabledPlans $null
	}
	else{
		$LicenseOptions = New-MsolLicenseOptions -AccountSkuId $license -DisabledPlans @($disabledServices.split(','))
	}
	
	$allUsers = Get-MsolUser -All | where {$_.BlockCredential -eq $false -and $_.UserType -ne "Guest" -and $_.isLicensed -eq $true -and $_.licenses[0].AccountSku.SkuPartNumber -eq ($license).Substring($license.IndexOf(":")+1, $license.Length-$license.IndexOf(":")-1)}
	$allUsers | ForEach-Object {
		$upn = $_.UserPrincipalName
		
		Try{
			Set-MsolUserLicense -UserPrincipalName $upn -LicenseOptions $LicenseOptions
			Write-Host "Services set for user" $upn -foregroundcolor Green
		}
		Catch{
			Write-Host "Error setting services for user ${$upn}: ${$_.Exception.Message}" -foregroundcolor Red
		}
	}
	
	Write-Host "Assigning licenses to all users done" -foregroundcolor Green
	Stop-Transcript
	Write-Host "Press enter to continue"
	Read-Host
	showMenu
}

$Cred = Get-Credential
Connect-MSOLService -Credential $Cred
showMenu

Happy scripting!