I recently had a customer that needed OneDrive for Business disabled on all their accounts in Office 365. I did a little digging and came across this article that explained how to disable it. It’s a pretty easy process although it’s much easier if you can disable it before your users have started using it.

Subsequently we needed to disable SharePoint completely and also make sure that the SharePoint component of their E3 licenses was unchecked. That’s a lot of clicking for 80 users. So I found this article from Microsoft on how to use PowerShell to accomplish this.  I had to work through a couple of missing parameters in one of the code sample they had in the article.

In this case, the script creates a license variable to disable any users that are running the CSP E3 SKU which is called: reseller-account-Enterprisepack. and it disables only the: "SHAREPOINTENTERPRISE", "SHAREPOINTWAC" subcomponents. I tried disabling just the SharePoint (SHAREPOINTENTERPRISE) component but It won’t let you because Office Web Apps (SHAREPOINTWAC) relies on SharePoint so you have to disable both if you want to disable the SharePoint Component. You can figure out what SKUs are on your account using this command:

 

Get-MsolAccountSku

Here's the Script:

$credential = Get-Credential

Import-Module MsOnline

Connect-MsolService -Credential $credential

$LO = New-MsolLicenseOptions -AccountSkuId "reseller-account:Enterprisepack" -DisabledPlans "SHAREPOINTENTERPRISE", "SHAREPOINTWAC"

$AllLicensed = Get-MsolUser -All | where {$_.isLicensed -eq $true}; $AllLicensed | foreach {Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -LicenseOptions $LO}

Nathan Taylor

Written by Nathan Taylor