PowerShell for Office365

Post on 07-Nov-2014

324 views 3 download

Tags:

description

Basics on PowerShell for Office365 Administration

Transcript of PowerShell for Office365

PowerShell for Office365Alberto Pascual · Office365 MVP

Serv

er

Vir

tualiz

ation

Alb

ert

o P

asc

ual

• Microsoft Certifications and awards- Office365 MVP- MCSA Windows Server 2008/2012- MCITP Windows Server 2008 Enterprise Administrator- MCTS 70-680 / 70-640 / 70-642 / 70-643- Microsoft Specialist – Administering Office365 for SMB (74-324)- MAP in 2010 and 2013- Small business specialist- Microsoft Community Contributor 2013 and 2014

• ITPro.es member - http://blogs.itpro.es/guruxp

• More than 20 years with IT

• Office365 migrations and deployments experienced

• Spanish Office365 Community forums Contributor and also English Technet fórums

• Co-Founder of the very first Office365 Community in Spain

@guruxp

a.pascual@Outlook.com

@guruxp

a.pascual@Outlook.com

Why PowerShell?

• GUI is cool and neat but powerless• GUI enthusiast? Think twice it´s all about efficiency• Automation = saved time• Similar to CMD but alot way better• Some things can only be done with PowerShell• IF GUI is down, PS is alive

The basics• PowerShell uses CmdLets to work • CmdLet = Verb+Noun (i.e Get-Help)• Switches make CmdLets better (i.e Get-Help Get-WmiObject –

full)• Modules store CmdLets• Thoussands of CmdLets avail within lots of modules + aliases

you create• You can chain CmdLets with “|”

• PowerShell uses autocomplete• You can create PowerShell script files (.ps1) to reuse them• Why use notepad or PowerShell console? Use ISE!

Online = On-Prem?

On-Prem Online

Exchange 2013 788 aprox 509 aprox

Lync 2013 700+ 48 aprox

Sharepoint 2013 700+ 28 aprox

Getting started• If On-Prem, Management Shell is included• If Online:• Install Windows PowerShell 3.0 (included in Windows 8)• Install Windows Management Framework (if < W7)• Install Microsoft Online Services Sign-In Assistant• Install Windows Azure Active Directory Module• Setup Execution Policy (as Admin)• Configure WinRM to use basic Auth (as Admin)• Install Sharepoint online PowerShell Admin module• Install Lync online PowerShell Admin module

Connecting to Services · Online Services• Connect-MSOLService

Connecting to Services · Exchange Online• $LiveCred = Get-Credential• $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic –AllowRedirection

• Import-PSSession $Session

Connecting to Services · Sharepoint Online• Connect-SPOService -Url https://contoso-admin.sharepoint.com -credential admin@contoso.com

Connecting to Services · Lync Online• $LiveCred = Get-Credential

• $Session = New-CSOnlineSession -Credential $LiveCred• Import-PSSession $Session

Automate your Login• Test-Path $profile• IF False -> New-Item –Path $profile –Type file –Force• If True -> notepad $profile• Paste:

Write-Host “To connect to O365 and Exchange Online type ‘Connect-O365′”Write-Host “To connect to Sharepoint Online type ‘Connect-SharepointOnline′”Write-Host “To connect to Lync Online type ‘Connect-LyncOnline′”Function Connect-O365{$Creds = Get-credential$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Creds -Authentication Basic -AllowRedirectionImport-PSSession $SessionImport-Module MsonlineConnect-MSOLService -credential $creds} 1/2

Automate your LoginFunction Connect-SharepointOnline{$Creds = Get-credentialConnect-SPOService -Url https://contoso-admin.sharepoint.com -credential $Creds$Url = Read-Host "Please Introduce the Sharepoint Admin Site URL"Connect-SPOService -Url $Url -credential $Creds}

Function Connect-LyncOnline{$LiveCred = Get-Credential$Session = New-CSOnlineSession -Credential $LiveCredImport-PSSession $Session }

2/2

DemoAutomating things

Unleash the PowerShell with EWS• Either do specific tasks or Interact with Apps• Just needs to install EWS Managed API from http://www.microsoft.com/download/en/details.aspx?id=28952

• EWS repository:http://msdn.microsoft.com/en-us/library/dd877302(v=exchg.150).aspx

DemoWorking with EWS

Questions?

@guruxpa.pascual@outlook.com

@guruxpa.pascual@outlook.com

THANKS!