a beginners guide to administering office 365 with power shell antonio maio

19
Internal Audit, Risk, Business & Technology Consulting A BEGINNERS GUIDE TO ADMINISTERING OFFICE 365 WITH POWERSHELL Antonio Maio Protiviti | Senior Enterprise Architect Microsoft Office Server and Services MVP Email: [email protected] Blog: www.trustsharepoint.com Slide share: http://www.slideshare.net/AntonioMaio2 Twitter: @AntonioMaio2

Upload: antoniomaio2

Post on 23-Jan-2018

189 views

Category:

Software


0 download

TRANSCRIPT

Page 1: A beginners guide to administering office 365 with power shell   antonio maio

Internal Audit, Risk, Business & Technology Consulting

A BEGINNERS GUIDE TO ADMINISTERING

OFFICE 365 WITH POWERSHELL

Antonio MaioProtiviti | Senior Enterprise ArchitectMicrosoft Office Server and Services MVP

Email: [email protected]: www.trustsharepoint.comSlide share: http://www.slideshare.net/AntonioMaio2Twitter: @AntonioMaio2

Page 2: A beginners guide to administering office 365 with power shell   antonio maio

© 2017 Protiviti Inc. An Equal Opportunity Employer M/F/Disability/Veterans. Protiviti is not licensed or registered as a public accounting firm and

does not issue opinions on financial statements or offer attestation services. All registered trademarks are the property of their respective owners.

Doesn’t the Office 365 Admin Centers give me everything I need to manage Office 365?

Page 3: A beginners guide to administering office 365 with power shell   antonio maio

© 2017 Protiviti Inc. An Equal Opportunity Employer M/F/Disability/Veterans. Protiviti is not licensed or registered as a public accounting firm and

does not issue opinions on financial statements or offer attestation services. All registered trademarks are the property of their respective owners.

Understand why you should use Office 365 PowerShell to manage Office 365, for efficiency and in some cases by necessity.

Efficiently

perform bulk

operations

Features you

can only

configure

using

PowerShell

Reveal info

you cannot

see in the

Office 365

Admin Center

Efficiently

Filter, Save

and Print

Data

Manage

Office 365

Across

Server

Products

Page 4: A beginners guide to administering office 365 with power shell   antonio maio

© 2017 Protiviti Inc. An Equal Opportunity Employer M/F/Disability/Veterans. Protiviti is not licensed or registered as a public accounting firm and

does not issue opinions on financial statements or offer attestation services. All registered trademarks are the property of their respective owners.

https://go.microsoft.com/fwlink/p/?LinkId=286152

https://go.microsoft.com/fwlink/p/?linkid=236297

https://go.microsoft.com/fwlink/p/?LinkId=255251

https://go.microsoft.com/fwlink/p/?LinkId=532439

Before you can manage all of Office 365 from a single instance of Windows PowerShell, consider these prerequisites.

Page 5: A beginners guide to administering office 365 with power shell   antonio maio

© 2017 Protiviti Inc. An Equal Opportunity Employer M/F/Disability/Veterans. Protiviti is not licensed or registered as a public accounting firm and

does not issue opinions on financial statements or offer attestation services. All registered trademarks are the property of their respective owners.

No scripts can be run. Windows PowerShell can be used only in interactive mode.

Only scripts signed by a trusted publisher can be run.

Downloaded scripts must be signed by a trusted publisher before they can be run.

No restrictions; all Windows PowerShell scripts can be run.

Set-ExecutionPolicy RemoteSigned

Learn how to set the Windows PowerShell script execution policy on your computer so that you can run scripts.

Page 6: A beginners guide to administering office 365 with power shell   antonio maio

© 2017 Protiviti Inc. An Equal Opportunity Employer M/F/Disability/Veterans. Protiviti is not licensed or registered as a public accounting firm and

does not issue opinions on financial statements or offer attestation services. All registered trademarks are the property of their respective owners.

verb-noun (for example, get-childitem)

.\myscriptname.ps1

.\myscriptname.ps1 –parameter1 value –parameter2 value

$PSVersionTable.PSVersion

Learn the basics of how to run and work with PowerShell

Page 7: A beginners guide to administering office 365 with power shell   antonio maio

© 2017 Protiviti Inc. An Equal Opportunity Employer M/F/Disability/Veterans. Protiviti is not licensed or registered as a public accounting firm and

does not issue opinions on financial statements or offer attestation services. All registered trademarks are the property of their respective owners.

Learn how to connect to these modules which are required for Office 365, SharePoint Online, and Skype for Business Online.

Page 8: A beginners guide to administering office 365 with power shell   antonio maio

© 2017 Protiviti Inc. An Equal Opportunity Employer M/F/Disability/Veterans. Protiviti is not licensed or registered as a public accounting firm and

does not issue opinions on financial statements or offer attestation services. All registered trademarks are the property of their respective owners.

$credential = Get-Credential

Connect-MsolService -Credential $credential

Simplest method to connect to Office 365 using PowerShell. Have access to easy-to-use cmdlets for Azure AD.

Page 9: A beginners guide to administering office 365 with power shell   antonio maio

© 2017 Protiviti Inc. An Equal Opportunity Employer M/F/Disability/Veterans. Protiviti is not licensed or registered as a public accounting firm and

does not issue opinions on financial statements or offer attestation services. All registered trademarks are the property of their respective owners.

$credential = Get-Credential

$exchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri"https://outlook.office365.com/powershell-liveid/" -Credential $credential -Authentication"Basic" –AllowRedirection

Import-PSSession $exchangeSession

Use any PowerShell module to run these cmdlets to connect and download cmdlets for Exchange Online Module for PowerShell.

Page 10: A beginners guide to administering office 365 with power shell   antonio maio

© 2017 Protiviti Inc. An Equal Opportunity Employer M/F/Disability/Veterans. Protiviti is not licensed or registered as a public accounting firm and

does not issue opinions on financial statements or offer attestation services. All registered trademarks are the property of their respective owners.

$credential = Get-Credential

$siteUrl = “https://<O365TenantDomain>-admin.sharepoint.com)”

Connect-SPOService -Url $siteUrl -credential $credential

Use the SharePoint Online Management Shell and these cmdlets to connect to SharePoint Online Module for PowerShell.

Page 11: A beginners guide to administering office 365 with power shell   antonio maio

© 2017 Protiviti Inc. An Equal Opportunity Employer M/F/Disability/Veterans. Protiviti is not licensed or registered as a public accounting firm and

does not issue opinions on financial statements or offer attestation services. All registered trademarks are the property of their respective owners.

$UserCredential = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUrihttps://ps.compliance.protection.outlook.com/powershell-liveid/ -Credential$UserCredential -Authentication Basic -AllowRedirection

Import-PSSession $Session

Use any PowerShell module to run these cmdlets to connect and download cmdlets for the Security & Compliance Center.

Page 12: A beginners guide to administering office 365 with power shell   antonio maio

© 2017 Protiviti Inc. An Equal Opportunity Employer M/F/Disability/Veterans. Protiviti is not licensed or registered as a public accounting firm and

does not issue opinions on financial statements or offer attestation services. All registered trademarks are the property of their respective owners.

$UserCredential = Get-Credential

$sfboSession = New-CsOnlineSession -Credential $credential

Import-PSSession $sfboSession

Use the Skype for Business Online Windows PowerShell Module and these cmdlets to connect to Skype for Business Online.

Page 13: A beginners guide to administering office 365 with power shell   antonio maio

© 2017 Protiviti Inc. An Equal Opportunity Employer M/F/Disability/Veterans. Protiviti is not licensed or registered as a public accounting firm and

does not issue opinions on financial statements or offer attestation services. All registered trademarks are the property of their respective owners.

Manage Azure AD using Windows PowerShell

Exchange Online Cmdlets

Windows PowerShell for SharePoint Online Cmdlets

Office 365 Security & Compliance Center Cmdlets

Skype for Business Online Cmdlets

Check these references for more Office 365 PowerShell cmdlets.

Page 14: A beginners guide to administering office 365 with power shell   antonio maio

© 2017 Protiviti Inc. An Equal Opportunity Employer M/F/Disability/Veterans. Protiviti is not licensed or registered as a public accounting firm and

does not issue opinions on financial statements or offer attestation services. All registered trademarks are the property of their respective owners.

User and license management related cmdlets.

Connect-MsolService

Connect to your Office 365 Service.

Get-MsolUser or Get-MsolUser | Select DisplayName, UsageLocation, UserPrincipalName

Display list of users currently within your Office 365 tenant.

Get-MsolUser –UnlicensedUsersOnly

Display only list of users in your Office 365 tenant which do not have a license.

Get-MsolAccountSku

Displays your Office 365 tenant license SKU. Use this when assigning a license.

Set-MsolUser -UserPrincipalName “<user’s upn>” -UsageLocation "US“

Set the location for a specific user by specifying the user principal name.

Set-MsolUserLicense -UserPrincipalName " <user’s upn> " -AddLicenses “<your license SKU“

Set a license for the specified user. Use the SKU displayed by the command above.

Get-MsolUser | Select DisplayName, UsageLocation, UserPrincipalName | Export-CSV –Path “c:\myusers.csv”

Gets a list of all users with specific attributes for each user, and outputs the list to a CSV file.

• Combine Powershell commands to assign licenses to all unlicensed users

Get-MsolUser -UnlicensedUsersOnly | Set-Msoluser - UsageLocation "US“

Get-MsolUser -UnlicensedUsersOnly | Set-MsolUserLicense -AddLicenses “<your license SKU>"

Page 15: A beginners guide to administering office 365 with power shell   antonio maio

© 2017 Protiviti Inc. An Equal Opportunity Employer M/F/Disability/Veterans. Protiviti is not licensed or registered as a public accounting firm and

does not issue opinions on financial statements or offer attestation services. All registered trademarks are the property of their respective owners.

User PowerShell to find out which cmdlets are available for a particular module.

Get-Command

Get-Command –Module msonline

Get-Command -Module Microsoft.PowerShell.Security

Get-Command | where {$_.ModuleName -eq "Microsoft.Online.SharePoint.PowerShell"}

Help <name of the command>

Page 16: A beginners guide to administering office 365 with power shell   antonio maio

© 2017 Protiviti Inc. An Equal Opportunity Employer M/F/Disability/Veterans. Protiviti is not licensed or registered as a public accounting firm and

does not issue opinions on financial statements or offer attestation services. All registered trademarks are the property of their respective owners.

There are more available then you realize.

There are 93 available

today!

Page 17: A beginners guide to administering office 365 with power shell   antonio maio

Internal Audit, Risk, Business & Technology Consulting

DEMONSTRATIONUsing PowerShell to Administer Office 365

Page 18: A beginners guide to administering office 365 with power shell   antonio maio

© 2017 Protiviti Inc. An Equal Opportunity Employer M/F/Disability/Veterans. Protiviti is not licensed or registered as a public accounting firm and

does not issue opinions on financial statements or offer attestation services. All registered trademarks are the property of their respective owners.

Learn PowerShell for Office 365 to become more efficient and access all the power of an Office 365 administrator!

Efficiently

perform bulk

operations

Features you

can only

configure

using

PowerShell

Reveal info

you cannot

see in the

Office 365

Admin Center

Efficiently

Filter, Save

and Print

Data

Manage

Office 365

Across

Server

Products

Page 19: A beginners guide to administering office 365 with power shell   antonio maio

Internal Audit, Risk, Business & Technology Consulting

THANK YOU

Antonio MaioProtiviti | Senior Enterprise ArchitectMicrosoft Office Server and Services MVP

Email: [email protected]: www.trustsharepoint.comSlide share: http://www.slideshare.net/AntonioMaio2Twitter: @AntonioMaio2