How to block or disable Office 365 Services

Sriram Varadarajan
 
Solution Architect
January 10, 2017
 
Rate this article
 
Views
8301

We don’t have any clear mechanism to disable POWER APP and MS FLOW from the ADMIN Centre of Office 365, as MS as moved these two services under E 4 license

The below PowerShell script would help disabling those:

 import-csv calip.csv | foreach-object {     // Input UPN name from the file and Start the Loop 
 
 
 $Teams = "Disabled"; $Sway = "Enabled"; $flow ="Disabled" ; $powerapps = "Disabled" ; $rms = "Disabled"; $voice = "Disabled" ; $project = "Enabled"
 $intune = "Enabled" ; $yammer = "Enabled" ; $office = "Enabled" ; $mcost = "Enabled" ; $spwac = "Enabled" ; $sp = "Enabled" ; $exc = "Enabled"         // Declare Variables
 
 (Get-MsolUser -User $_.Upn).Licenses[0].ServiceStatus | ForEach {          //Check the Current license status for all the users  
 If ($_.ServicePlan.ServiceName -eq "SWAY" –and $_.ProvisioningStatus -eq "Disabled") { $Sway = "Disabled" }   // If exisiting status is Disabled update the Variable to Disabled 
 If ($_.ServicePlan.ServiceName -eq "PROJECTWORKMANAGEMENT" –and $_.ProvisioningStatus -eq "Disabled") { $project = "Disabled" } 
 If ($_.ServicePlan.ServiceName -eq "INTUNE_O365" –and $_.ProvisioningStatus -eq "Disabled") { $intune = "Disabled" } 
 If ($_.ServicePlan.ServiceName -eq "YAMMER_ENTERPRISE" –and $_.ProvisioningStatus -eq "Disabled") { $yammer = "Disabled" } 
 If ($_.ServicePlan.ServiceName -eq "MCOSTANDARD" –and $_.ProvisioningStatus -eq "Disabled") { $mcost = "Disabled" } 
 If ($_.ServicePlan.ServiceName -eq "SHAREPOINTWAC" –and $_.ProvisioningStatus -eq "Disabled") { $spwac = "Disabled" } 
 If ($_.ServicePlan.ServiceName -eq "SHAREPOINTENTERPRISE" –and $_.ProvisioningStatus -eq "Disabled") { $sp = "Disabled" } 
 If ($_.ServicePlan.ServiceName -eq "EXCHANGE_S_ENTERPRISE" –and $_.ProvisioningStatus -eq "Disabled") { $exc = "Disabled" } 
 }
 
 
 $DisabledOptions = @()   //Declare Array 
 
 If ($Sway -eq "Disabled") { $DisabledOptions += "SWAY" }        // Based on the variable Add the plans to disable in Variable 
 If ($Teams -eq "Disabled") { $DisabledOptions += "TEAMS1" }    // Append the plans to Disable 
 If ($flow -eq "Disabled") { $DisabledOptions += "FLOW_O365_P2" } 
 If ($powerapps -eq "Disabled") { $DisabledOptions += "POWERAPPS_O365_P2" } 
 If ($rms -eq "Disabled") { $DisabledOptions += "RMS_S_ENTERPRISE" } 
 If ($voice -eq "Disabled") { $DisabledOptions += "MCOVOICECONF" } 
 If ($project -eq "Disabled") { $DisabledOptions += "PROJECTWORKMANAGEMENT" } 
 If ($intune -eq "Disabled") { $DisabledOptions += "INTUNE_O365" } 
 If ($yammer -eq "Disabled") { $DisabledOptions += "YAMMER_ENTERPRISE" } 
 If ($mcost -eq "Disabled") { $DisabledOptions += "MCOSTANDARD" } 
 If ($spwac -eq "Disabled") { $DisabledOptions += "SHAREPOINTWAC" } 
 If ($sp -eq "Disabled") { $DisabledOptions += "SHAREPOINTENTERPRISE" } 
 If ($exc -eq "Disabled") { $DisabledOptions += "EXCHANGE_S_ENTERPRISE" } 
 
 $LicenseOptions = New-MsolLicenseOptions –AccountSkuId "Collaboration:ENTERPRISEWITHSCAL" –DisabledPlans $DisabledOptions     // Store the new license option in the Variable 
 
 Set-MsolUserLicense –User $_.UPN –LicenseOptions $LicenseOptions    // Apply the new license option from the file 
 
 $cool = $_.UPN  // Used to check how many users completed from the file in case if script breaks due to server error 
 
 
 }

Note: Disabling TEAM using PowerShell didn’t work as expected, the only option to disable TEAM is by going to Services & add-ins under ADMIN Center and disable TEAM.

To know the latest happening around PowerAPP and MS FLOW please refer

StaffHub

It’s a new feature from MS and it’s in preview, Once you have signed up for the preview, you can assign the Microsoft StaffHub licenses to users. This PowerShell Script will apply the license to EVERYONE in your tenant.  Note: Please make sure everyone you want to have access to Microsoft StaffHub ALSO has a K1, E1, E3, or E5 license assigned.

 Connect-MsolService 
 $licenseObj = Get-MsolAccountSku | Where-Object {$_.SkuPartNumber -eq “DESKLESS"} 
 $license = $licenseObj.AccountSkuId 
 Get-MSOLUser -All | Set-MsolUserLicense -AddLicenses $license
Category : Office 365, SharePoint

Author Info

Sriram Varadarajan
 
Solution Architect
 
Rate this article
 
Sriram is a Technology Evangelist with 15+ years experience in Microsoft Technologies. He is an enterprise architect working for large pharmaceutical organization which has presence globally with largest Microsoft implementation ...read more
 

Leave a comment