Jump to content

Recommended Posts

Posted
Need a hand finding the powershell command to remove Lync from my current A2 Sku.

Thanks!

 

Do you just want to remove the licences for X amount of users?

 

James.

Posted

Hi,

 

You can BULK modify the Licensing for Accounts using the following PowerShell Script:

 

Connect-MSOLService

$AccountSkuId="Insert SKU Here"

$UsageLocation="GB"

$LicenseOptions=New-MsolLicenseOptions -AccountSkuId$AccountSkuId

$Users=Import-Csvc:\Users.csv

$Users|ForEach-Object{

Set-MsolUser -UserPrincipalName$_.UserPrincipalName -UsageLocation$UsageLocation

Set-MsolUserLicense -UserPrincipalName$_.UserPrincipalName -AddLicenses$AccountSkuId-LicenseOptions$LicenseOptions

}

 

The part in which you want to edit if you should wish to disable certain aspects is as follows:

 

$LicenseOptions = New-MsolLicenseOptions -AccountSkuId $AccountSkuId –DisabledPlans SHAREPOINTWAC,SHAREPOINTENTERPRISE

 

In this example I am disabling SharePoint Online & Office Web Applications. If you want to disable Lync Online then you need to use the following: MCOSTANDARD

 

To be honest, If you want to find out more information you should refer to the following article which is pretty handy (MS hadn't published this when I last did it so just found it out)

 

Disable Lync Online, SharePoint Online, or both

 

I hope that helps,

 

James.

Posted
I've asked MS to remove the sku on the backed for my students. If that doesn't work I'll play with the script, although that could be tricky since we are fully automating account creation. Thanks for the responses.
Posted
I've asked MS to remove the sku on the backed for my students. If that doesn't work I'll play with the script, although that could be tricky since we are fully automating account creation. Thanks for the responses.

 

I don't think Microsoft Support will do that (not ordinarily anyway).

 

How do you handle your licensing at the moment, given that you have fully automated account creation? The steps above, broadly speaking, are what you need to build a script to assign sub-components of the A2 plan if you don't want to assign the full plan.

 

It would be fairly straightforward to build a script that reads an attribute from your users (lets say you populate customAttribute1 with "student" or "teacher") and then assigns the correct workloads from that.

Posted (edited)

When we sync our users, we assign the students the following powershell to assign the licence

 

$LicOptions = New-MsolLicenseOptions -AccountSkuId tenancynamehere:STANDARDWOFFPACK_STUDENT -DisabledPlans MCOSTANDARD, SHAREPOINTWAC_EDU, SHAREPOINTSTANDARD_EDU

Set-MsolUserLicense -UserPrincipalName $user.UserPrincipalName -AddLicenses "tenancynamehere:STANDARDWOFFPACK_STUDENT" -LicenseOptions $LicOptions

 

 

This just gives the students e-mail and not Lync. We have this in a search to ensure it's just the kids that it applys to and not staff

Here is our full script

#Set the license options for Office 365, which in this case is just Exchange access

$LicOptions = New-MsolLicenseOptions -AccountSkuId tenancy:STANDARDWOFFPACK_STUDENT -DisabledPlans MCOSTANDARD, SHAREPOINTWAC_EDU, SHAREPOINTSTANDARD_EDU

#Search for users that have no licences as they have just been syncronised and store into array where username begins STU

$users = Get-MsolUser -UnlicensedUsersOnly -Synchronized -MaxResults 50 | Where-Object {$_.UserPrincipalName -like "STU????-*" }

#If we have no users then we can exit out of the script

if (!($users)) {exit;}

 

#For each user we found, we will loop thought them and apply settings

Write-Host "Set Licence"

foreach ($user in $users)

{

#Displays on screen the user we are updaing purely for debugging purpose

Write-Host $user.UserPrincipalName

#Set the Location to GB for the user which resolves the "error" that is detected

Set-MsolUser -UserPrincipalName $user.UserPrincipalName -UsageLocation GB

#Set the Office 365 license for the user based on the value selected above. This is purely for students

Set-MsolUserLicense -UserPrincipalName $user.UserPrincipalName -AddLicenses "tenancy:STANDARDWOFFPACK_STUDENT" -LicenseOptions $LicOptions

}

 

#Pause the script for 1 minute to ensure that the account has been created by Exchange before we start processing the next bit. Not really needed for bulk uploads

Start-Sleep -Seconds 60

 

Write-Host ""

Write-Host "Set Exchange"

#Loop though each user again, but this time we are altering their e-mail settings

foreach ($user in $users)

{

#Again for debug purpose we write out their name

write-Host $user.UserPrincipalName

#Set their Address book, role assignment and sharing policy to be the student related one

Set-Mailbox -Identity $user.UserPrincipalName -AddressBookPolicy "ABP_Students" -RoleAssignmentPolicy "Pupil Role Assignment Policy" -SharingPolicy "Pupil Sharing Policy"

#Set the OWA Mailbox Policy

Set-CASMailbox -Identity $user.UserPrincipalName -OwaMailboxPolicy "Pupils"

}

 

exit

Forgot to say, we run this script as a scheduled task every hour to ensure that any new students that DirSync has added gets the correct settings without us having to worry about it. So far it's been working great :)

Edited by Boredguy
Posted
We are using UMRA by tools forever, it pulls the users from our SIS, generates the AD accounts and creates their Office 365 email account. I wonder if I can just add the -DisabledPlans MCOSTANDARD to where I declare the variable for the SKU. Going to check with the vendor (tools4ever). It sounds like I could also run a scheduled task to strip the sku from the user.
  • 1 month later...
Posted
What exactly is a License Object? Are these temporary, or not? In those scripts on the MS website you have to create License Objects and I am just wondering whether you have to create license objects each time?
Posted

We do this for all our 170 schools - disabled Lync and Exchange.

 

We have to run a script of powershell every week or so, as new accounts being created in the tenancies by the provisioning methods we use (RM Unify from MIS and AD in the cloud) get the licences automatically assigned, but it's an easy job to do.

 

If you want info on the script I can post it up I'm sure...need to speak to my techie team!

Posted
We do this for all our 170 schools - disabled Lync and Exchange.

 

We have to run a script of powershell every week or so, as new accounts being created in the tenancies by the provisioning methods we use (RM Unify from MIS and AD in the cloud) get the licences automatically assigned, but it's an easy job to do.

 

If you want info on the script I can post it up I'm sure...need to speak to my techie team!

Be interesting to see your script. What do you use Office365 for then exactly?
Posted

Well - completed our first course today for SharePoint 2013 (amongst other things)

 

We use RM Unify (Discover: RM Unify) to provision our accounts in to Office 365..... We also have the RM Site Creator tool for Office 365 which makes things is SharePoint so much easier to set up!

 

Since our schools had a SharePoint based Learning Platform previously this is a natural (and very well received today (bar no parent access and the Newsfeed issue!!)) progression for them.

 

We will then be releasing Office 365 Exchange to them very shortly (currently disabled via script as per this thread) until we are ready to release.... after that we plan to bring them on board with Lync and give them the more advanced features!

 

Large scale project! Good fun but challenging!

 

Rich

Posted

So this script is used for the exchange side of things:

 

#Connect to O365

 

connect-MsolService

 

#Export all student users

 

Get-MsolUser -All | Where-Object { $_.Licenses[0].AccountSkuId -match "FACULTY" } | Export-Csv "C:\students.csv"

 

#Export all staff users

 

Get-MsolUser -All | Where-Object { $_.Licenses[0].AccountSkuId -match "FACULTY" } | Export-Csv "C:\staff.csv"

 

#variable to import student csv

 

$students = Import-Csv "c:\students.csv"

 

#variable to import staff csv

 

$staff = Import-Csv "c:\staff.csv"

 

# Office365 A2 Plans

# SHAREPOINTWAC_EDU (SharePoint Online Web Apps)

# MCOSTANDARD (Lync Online)

# SHAREPOINTSTANDARD_EDU (Sharepoint Online)

# EXCHANGE_S_STANDARD (Exchange Online

#Variables to disable Exchange plan for student and staff

 

$NoExch = New-MsolLicenseOptions -AccountSkuId "LaunchPad365Demo:STANDARDWOFFPACK_STUDENT" -DisabledPlans EXCHANGE_S_STANDARD

$NoExch2 = New-MsolLicenseOptions -AccountSkuId "LaunchPad365Demo:STANDARDWOFFPACK_FACULTY" -DisabledPlans EXCHANGE_S_STANDARD

 

#Apply plans to students

 

$students | ForEach-Object {Get-MsolUser -UserPrincipalName $_.UserPrincipalName} | Set-MsolUserLicense -LicenseOptions $NoExch

 

#Apply plans to staff

 

$staff | ForEach-Object {Get-MsolUser -UserPrincipalName $_.UserPrincipalName} | Set-MsolUserLicense -LicenseOptions $NoExch2

 

To turn off Lync:

 

To disable Lync the plan is called MCOSTANDARD so in the code you would just replace EXCHANGE_S_STANDARD with MCOSTANDARD

 

If you want to disable Exchange and Lync you would change it to EXCHANGE_S_STANDARD,MCOSTANDARD

 

Hope that helps some people or maybe that isn't the best way of doing it! Suggestions and support always welcome :)

 

Rich

  • 9 months later...
Posted

Just coming back to this.

 

#Export all student users

Get-MsolUser -All | Where-Object { $_.Licenses[0].AccountSkuId -match "FACULTY" } | Export-Csv "C:\students.csv"

#Export all staff users

Get-MsolUser -All | Where-Object { $_.Licenses[0].AccountSkuId -match "FACULTY" } | Export-Csv "C:\staff.csv"

Does FACULTY need to be replaced with something, else that will both bring back the same for staff and students?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...