Wednesday, November 27, 2013

Auto add specific Office 365 licenses to all users

Ever needed to only add Exchange Online licenses to thousands of users in Office 365? Well i did. Since i didn't want to click i created a powershell script for it.

I have created this particular script for an academic company. Therefore the plan and the service options are specifically for an educational company.

This scripts add the users based on the attribute "Office". If this attribute is empty it's an employee, if the attributed is not empty it's a student. The scripts saves the output to a logfile and also to the display (including a progressbar :)).

If you want to know what plans are available in your tenant, you can type in the below commands in a powershell session:
Import-Module MSOnline
Connect-MsolService -Credential (Get-Credential)

Once you have the subscriptions you can narrow it down to only the services available in the subscription by using the below command:
Get-MsolSubscription -SubscriptionId  | select-object -ExpandProperty servicestatus

Here is the script. Have fun with it!
Import-Module MSOnline
Connect-MsolService -Credential (Get-Credential)
$GlobalLog = "D:\Scripts\Logs\$(gc env:computername)_$(get-date -format hhmm_ddMMyyyy).log"
$Date =  get-date -Format "hh:mm:ss - dd MMMM yyyy"
$Users = Get-MsolUser -All
$Location = "NL"

#Faculty members
$PlanFc = New-MsolLicenseOptions -AccountSkuId $Faculty -DisabledPlans $LicOptions 

$PlanSt = New-MsolLicenseOptions -AccountSkuId $Student -DisabledPlans $LicOptions

function LogLine {
 Add-content $GlobalLog -value $LogInput

function LogHeader {
 LogLine "--------------------------------------------------------------------------------"
 LogLine "Adding user licenses:"
 LogLine "Time: $Date"
 LogLine "--------------------------------------------------------------------------------"

function LicAdd {
$Users | ForEach-Object -Begin {Clear-Host;$i=0;$Stu=0;$Fac=0} -Process `
 if ($_.IsLicensed -ne "TRUE")
 Set-MsolUser -UserPrincipalName $_.Userprincipalname -UsageLocation $Location
   if ($_.Office -ne $null) 
       $User = $_.UserPrincipalName
    Set-MsolUserLicense -UserPrincipalName $User -AddLicenses $Student -LicenseOptions $PlanSt
    LogLine "Added student license for user $User"
    Write-Host "Added student license for user" $User -ForegroundColor 'Gray'
    #Start-Sleep -Milliseconds 30
    $User = $_.UserPrincipalName
    Set-MsolUserLicense -UserPrincipalName $User -AddLicenses $Faculty -LicenseOptions $PlanFc
    LogLine "Added faculty license for user $User"
    Write-Host "Added faculty license for user" $User -ForegroundColor 'Green'
    #Start-Sleep -Milliseconds 30
 write-progress -activity "Adding licenses" -status "Progress:" -percentcomplete ($i/$users.count*100)
 $i = $i+1
} `
-end {}
LogLine "--------------------------------------------------------------------------------"
LogLine "Number licenses added for students: $Stu"
LogLine "Number licenses added for faculty employees: $Fac"
LogLine "--------------------------------------------------------------------------------"
LogLine ""


Thursday, November 14, 2013

Free TechSmith Software for Technology Leaders

If you are a Microsoft Certified Trainer (MCT) or Most Valuable Professional (MVP) you can get Camtasia Studio and Snagit for free! That's what someone (another MCT) was telling me earlier this week. Seems that the deal is still active after many years (since 2009). Didn't know that myself actually, so therefore this blogpost as a reminder. Just go to MCT Request Form or MVP Request Form to request an activation key. Very cool as you ask me!
Download can be done here:
-Snagit PC or MAC
Record onscreen activity at your desk or in front of an audience and create eye-catching HD-quality training, presentation, and demo videos. Enhance them with editing effects like callouts, transitions and more. Then share for viewers to watch on-demand…anytime, anywhere.

-Camtasia Studio PC or MAC
Quickly create professional quality videos that you can share with
 anyone, on nearly any device – without formal training. Use Camtasia to give presentations, train audiences, share knowledge, and more.

@TechSmit Software Thanks for the software and free licenses!
@Henk Hoogendoorn Thanks for pointing it out to me