PowerShell to the rescue! Managing Office 365 without the admin center.

PowerShell to the rescue! Managing Office 365 without the admin center.

Real admins use PowerShell - I'm sure you all agree. Joking aside, there's only so much you can do from within the Office 365 admin center or the various other web-based administration tools of the platform. Many of the more interesting management capabilities are hidden well beneath the surface, in PowerShell commandlets. Although Microsoft already provides a few modules out of the box, true power lies within community projects such as the PnP initiative. In this session, we'll explore their capabilities, where to get them and how to use them in your own projects. Last but not least we will touch upon the latest developments within the PowerShell platform itself, which has gone through very significant changes the last few years - and still does.


Thomas Vochten

June 30, 2018


  1. PowerShell to the rescue! Managing Office 365 without the admin

    center Thomas Vochten Nico Martens
  2. None
  3. Who this talk is for… • You already know some

    PowerShell • You know your way around the Office 365 admin center • You’re not your company’s automation wizard or devops guru • You’re just here for to hear a Belgian guy talk funny
  4. About Us Nico Martens SharePoint engineer @ @martensnico http://www.sharepointrelated.com Thomas

    Vochten solution architect @ @thomasvochten https://thomasvochten.com
  5. Agenda • Using PowerShell • PowerShell and Office 365 •

    Get Involved! • Alternative to PowerShell
  6. Using PowerShell

  7. PowerShell you say? • Some tasks are only available in

    PowerShell • Anything you need to do more than once • Automating tasks should be one of your life goals
  8. Sharing is Caring PowerShell is open source now https://github.com/PowerShell May

    2018 - June 2018
  9. There’s two versions of PowerShell PowerShell • The old and

    trusted • .NET Framework • Windows only • powershell.exe • versions 1.0 > 5.1 • continues to be supported PowerShell Core • The new kid on the block • .NET Core • Cross platform • pwsh.exe • version 6 and beyond • the way forward Both versions can be used side-by-side on the same system
  10. PowerShell Core is upon us! • PowerShell Core 6.0 was

    released in January of 2018 • Currently at version 6.0.2 • Cross-platform: Windows, macOS and Linux sudo apt-get install powershell
  11. PowerShell Core

  12. PowerShell

  13. PowerShell hosts & editors • PowerShell console • PowerShell ISE

    - Deprecated • Visual Studio Code
  14. Visual Studio Code for authoring & debugging • Don’t worry

    - you don’t have to be a developer • VSCode is extensible & customizable • Great for authoring • Takes some getting used to for debugging • You need the PowerShell extension!
  15. None
  16. Working with Modules 101 • Functionality is delivered through modules

    • Download manually or use the PowerShell Gallery https://www.powershellgallery.com/ • [verb]-Module • How to know where to find them? • How to know which ones you have installed?
  17. Working with Modules 101 - Community Github • "Cloud for

    code" • Private / public repositories PowerShell Gallery • One stop shop for all published PowerShell content
  18. PowerShell and Office 365

  19. Office 365 PowerShell Overview

  20. Flow & PowerApps (preview)

  21. Prerequisites • Office 365 Admin Role (Global or service admin,

    depending on which service you want to use) • Windows 7 SP1 or higher • The necessary modules: https://docs.microsoft.com/en- us/office365/enterprise/powershell/manage-office-365-with-office- 365-powershell
  22. You might also need… • Microsoft Online Services Sign-in Assistant

    for IT Professionals RTW: https://go.microsoft.com/fwlink/p/?LinkId=286152
  23. Installing remaining modules • Install-Module AzureAD • Install-Module MSOnline •

    Install-Module MicrosoftTeams • Install-Module SharePointPnPPowerShellOnline https://github.com/SharePoint/PnP-PowerShell
  24. Are you confused yet?

  25. …or use the power of community! https://www.powershellgallery.com/packages/Office365.Connect/ Connect-Office365 -Tenant "sharepointrelated"

  26. Demo Office365.Connect

  27. When to use which module? Cmdlet contains Module *-Msol* MSOnline

    *-AzureAD* AzureAD *-SPO* Microsoft.Online.SharePoint.PowerShell *-CS* SkypeOnlineConnector *-Team* MicrosoftTeams *-CC* SecurityCompliance *-PnP* SharePointPnPPowerShellOnline
  28. What about SharePoint? Admin tasks Content Anything that would require

    CSOM PowerShell VS Install-Module –Name SharePointPnPPowerShellOnline
  29. SharePoint Online PowerShell vs PNP Add a list item -

    SharePoint Online PowerShell Add a list item - PNP PowerShell
  30. 300+ Commandlets

  31. Commandlet categories

  32. Demo Office 365 PowerShell

  33. PowerShell and multi-factor authentication Office 365 Administrator accounts should always

    use multi-factor authentication (MFA).
  34. Demo PowerShell with MFA

  35. Don’t store passwords in your scripts! • Prompt for credentials,

    or better: • Use the CredentialManager module Install-Module CredentialManager $credential = Get-StoredCredential SPSNL18
  36. Demo Using the Credential Manager

  37. Get Involved!

  38. Write your own! • Contribute to open source • Learn

    how to write & document modules • Plaster • Pester • PlatyPS • PSScriptAnalyzer • Learn Git & Github • Learn to use Visual Studio Code
  39. Alternative to PowerShell

  40. What, no PowerShell? Introducing the Office 365 CLI https://github.com/pnp/office365-cli

  41. None
  42. None
  43. Key Takeaways • Get familiar with PowerShell if you aren’t

    already • Learn how to work with modules • Learn to use Visual Studio Code • Know where to get the modules you need • Tap into the power of community and contribute
  44. @martensnico @thomasvochten

  45. Resources • Learning PowerShell • PowerShell documentation • PowerShell Core

    release announcement • Office 365 PowerShell modules overview • SharePoint PnP PowerShell on Github