Mais conteúdo relacionado
Semelhante a yOS Montpellier - Piloter Office 365 grâce à powershell - Les indispensables (20)
Mais de Benoit Jester (16)
yOS Montpellier - Piloter Office 365 grâce à powershell - Les indispensables
- 1. yOS-Tour - yOS-Day ©2015. All rights reserved.
#2 – yOS-Day à Montpellier le 12 juin 2015
www.yos-tour.com
contact@yos-tour.com
@YosTour
- 2. yOS-Tour - yOS-Day ©2015. All rights reserved.
PowerShell pour Office 365
Piloter Office 365 grâce à PowerShell - Les indispensables
+ =
- 3. yOS-Tour - yOS-Day ©2015. All rights reserved.
Benoît Jester
MVP SharePoint, travaillant sur cette technologie depuis 10 ans.
Administration, expertise SharePoint, Cloud, …
t: @spasipe
b: spasipe.wordpress.com
F: Benoit Jester
- 4. yOS-Tour - yOS-Day ©2015. All rights reserved.
Etienne Bailly
MCT | Office 365 & SharePoint enthusiast
Fondateur de la société ISTEP
t: @etienne_bailly
b: http://www.istep.fr/blog
F : Etienne Bailly (Microsoft Certified Trainer)
- 6. yOS-Tour - yOS-Day ©2015. All rights reserved.
PowerShell ?
Pourquoi PowerShell pour Office 365 ?
Let’s connect to Office 365
PowerShell SharePoint
Démos !
Un peu de lecture …
Au menu de cette présentation
- 8. yOS-Tour - yOS-Day ©2015. All rights reserved.
Langage de script orienté objet - repose sur le Framework .Net
Snapins / Modules
Cmdlets / Functions
• Ex : Get-Service, Set-SPContentDatabase, …
Paramètres
• -Debug, -ErrorAction, -ErrorVariable, -Whatif, -Confirm
Alias
• dir Get-ChildItem
• cd Set-Location
• gcm Get-Command
PowerShell ?
- 9. yOS-Tour - yOS-Day ©2015. All rights reserved.
Cmdlet Description Alias
Get-Help
Aide sur une commande
-example
help, man
Get-Member Retourne les propriétés, méthodes d’un objet gm
Get-Module Liste les modules chargés gmo
Get-PSSnapin Liste les « snapins » chargés gsnp
Get-Command Ou « Show-Command » montre les Cdlets du Module
gcm
shcm
Description Alias
|
Un « Pipeline » peut contenir une ou plusieurs
commandes séparées par le caractère « pipe » ( | )
$PSItem Représente l’objet courant $_
Where Ou « Where-Object » ou « ? » ?
ForEach Ou « ForEach-Object » ou « % » %
Select Définit les propriétés à récupérer
Un peu de syntaxe …
Description
Import-Csv Import CSV
Out-File Export fichier (.txt)
Out-Csv Export CSV (.csv)
- 10. yOS-Tour - yOS-Day ©2015. All rights reserved.
PowerShell – quelques exemples
# Accès au journal des événements (Event Viewer). 50 dernières connexions
# "C'est ki ki s'est connecté pour tout fracasser sur le serveur de Prod ??"
Get-EventLog -LogName Security |
Where EventID -eq 4624 |
Select -First 50
# Les fichiers supérieurs à 50 Mb (en cascade - récursif)
Get-ChildItem -Path c:temp -Recurse | Where-Object { $_.Length -gt 20MB }
# Les services Windows démarrés
Get-Service | Where { $_.Status –eq 'Running' }
# Les process IIS gourmands....
Get-Process | Where { $_.Name -like "*w3wp*" -and $_.PM –gt 300MB } | Sort PM -Descending
- 12. yOS-Tour - yOS-Day ©2015. All rights reserved.
Six raisons pour lesquelles nous vous recommandons d’utiliser Windows PowerShell pour gérer Office 365
PowerShell, Pourquoi ?
Windows PowerShellpeut
révélerdes informations«
masquées», non disponibles
dans le Centred’administration
Office 365 comporte des
fonctionnalitésque vous ne
pouvez configurer qu’àl’aide de
Windows PowerShell
Windows PowerShellexcelle à
effectuerdesopérationsen
bloc
Windows PowerShellfiltre
efficacementles données
Windows PowerShellfacilite
l’impressionou
l’enregistrementdesdonnées
Windows PowerShellpermet
une gestion reposantsur
plusieursproduits
C’est tout ?
Non, pas tout à fait : l’utilisation de Windows PowerShell dans le cadre de la gestion d’Office 365 est
pratiquement illimitée
- 13. yOS-Tour - yOS-Day ©2015. All rights reserved.
Les différents outils pour administrer Office 365
- 15. yOS-Tour - yOS-Day ©2015. All rights reserved.
Windows 7, 8, 8.1, …
Windows Server 2008 R2, Windows Server 2012, 2012 R2
Microsoft .NET Framework 3.51 (min)
Microsoft Online Services Sign-in Assistant
Module Azure Active Directory pour Windows PowerShell
Prérequis – PowerShell pour Office 365
- 16. yOS-Tour - yOS-Day ©2015. All rights reserved.
Microsoft Online Services Sign-In Assistant
https://www.microsoft.com/en-us/download/details.aspx?id=41950
- 17. yOS-Tour - yOS-Day ©2015. All rights reserved.
Microsoft Online Services Sign-In Assistant
- 18. yOS-Tour - yOS-Day ©2015. All rights reserved.
Module Azure Active Directory pour
Windows PowerShell http://go.microsoft.com/fwlink/p/?linkid=236297
- 19. yOS-Tour - yOS-Day ©2015. All rights reserved.
Se connecter à Office 365 avec PowerShell
##################################
# Connexion à Office 365
Import-Module MSOnline
$c = Get-Credential
Connect-MsolService –Credential $c
- 20. yOS-Tour - yOS-Day ©2015. All rights reserved.
Connexion à Exchange Online
avec PowerShell
##################################
# Connexion à Exchange Online
Import-Module MSOnline # Azure AD Module
$c = Get-Credential
$exchSession = New-PSSession `
–ConfigurationName Microsoft.Exchange `
-ConnectionUri https://ps.outlook.com/powershell `
-Credential $c `
-Authentication Basic `
–AllowRedirection
Import-PSSession $exchSession –AllowClobber
Set-ExecutionPolicy RemoteSigned
Connect-MsolService –Credential $c
- 21. yOS-Tour - yOS-Day ©2015. All rights reserved.
Connexion à Exchange Online
avec PowerShell
- 22. yOS-Tour - yOS-Day ©2015. All rights reserved.
Connexion à Exchange Online
avec PowerShell
- 23. yOS-Tour - yOS-Day ©2015. All rights reserved.
Les univers « PowerShell » Office 365
Petite gymnastique : Un langage unique mais des modules séparés
# Exchange Online
$exchSession = New-PSSession `
–ConfigurationName Microsoft.Exchange `
-ConnectionUri https://ps.outlook.com/powershell `
-Credential $c `
-Authentication Basic `
–AllowRedirection
Import-PSSession $exchSession –AllowClobber
# SharePoint
Import-Module Microsoft.Online.Sharepoint.PowerShell
Connect-SPOService -Url https://tenant-admin.sharepoint.com/ -Credential $c
Module Azure Active Directory
(MSOnline)
# Skype for Business (aka Lync Online)
Import-Module LyncOnlineConnector
$skypeSession = New-CsOnlineSession -Credential $c
Import-PSSession $skypeSession –AllowClobber
- 25. yOS-Tour - yOS-Day ©2015. All rights reserved.
Installation
• PowerShell 3.0
• SharePoint Online Management Shell
Utilisation
• Lancement du Shell
• Connexion au Centre d’administration SharePoint Online
• Enjoy !
Installation et Connexion
- 26. yOS-Tour - yOS-Day ©2015. All rights reserved.
David contre Goliath
• SharePoint On-Premises : 772 cmdlets
• SharePoint Online : 33 cmdlets
Nommage OnPrem vs Online
• Get-SPSite / Get-SPOSite
• Add-SPUser / Add-SPOUser
• Upgrade-SPSite / Upgrade-SPOSite
Les cmdlets SPO, quelles limitations ?
• Leur nombre
• Leur périmètre d’utilisation
Cmdlets SharePoint vs SharePoint Online
- 27. yOS-Tour - yOS-Day ©2015. All rights reserved.
Collections de site
• Get-SPOSite / New-SPOSite / Remove-SPOSite / Set-SPOSite
• Repair-SPOSite / Test-SPOSite / Upgrade-SPOSite / Request-SPOUpgradeEvaluationSite
• Get-SPODeletedSite / Remove-SPODeletedSite / Restore-SPODeletedSite
Tenants
• Get-SPOTenant
• Get-SPOTenantLogEntry
• Get-SPOTenantLogLastAvailableTimeInUtc
• Set-SPOTenant
Utilisateurs
• Add-SPOUser / Get-SPOUser / Remove-SPOUser / Set-SPOUser
• Get-SPOExternalUser / Remove-SPOExternalUser
Cmdlets SharePoint Online - Périmètre
- 28. yOS-Tour - yOS-Day ©2015. All rights reserved.
PowerShell Command Builder
PowerShell Command Builder
- 29. yOS-Tour - yOS-Day ©2015. All rights reserved.
Opérations « basiques »
• Recensement et export csv des collections de site d’un tenant
• Départ d’un employé : remplacement de l’utilisateur par un autre
Pour aller plus loin …
• Créer une liste ?
• Supprimer un sous-site ?
Les cmdlets ne le permettent pas
La solution ?
• Associer ces cmdlets à du CSOM
Quelques exemples d’utilisation des cmdlets
- 30. yOS-Tour - yOS-Day ©2015. All rights reserved.
Client Side Object Model
• Sous-ensemble du modèle objet
• Utilisation différente
Pourquoi utiliser CSOM en plus des cmdlets SPO?
• Les cmdlets SPO sont utilisables au niveau du tenant
• CSOM est utilisable à tous les niveaux
Utilisation
• Possibilités infinies en combinant les 2
• Ex : Récupération des MySites (non renvoyés par le cmdlet Get-SPOSite)
Cmdlets SPO+ CSOM =
- 31. yOS-Tour - yOS-Day ©2015. All rights reserved.
Office 365 Developer Patterns and Practices
https://github.com/OfficeDev/PnP/wiki
https://github.com/OfficeDev/PnP
Yammer - O365 Dev Patterns & Practices
- 33. yOS-Tour - yOS-Day ©2015. All rights reserved.
Office 365 PnP - Vos identifiants ? Stockez-les !
# SharePoint Online with PNP PowerShell Commands ###
Import-Module Microsoft.Online.Sharepoint.PowerShell
Connect-SPOnline -Url https://istep365.sharepoint.com -Credentials etienneO365
Get-SPOWeb
- 35. yOS-Tour - yOS-Day ©2015. All rights reserved.
Démo – Mettre en place une signature dynamique
Import-Module MSOnline
$c = Get-Credential
$session = New-PSSession –ConfigurationName Microsoft.Exchange `
-ConnectionUri https://ps.outlook.com/powershell
-Credential $c -Authentication Basic –AllowRedirection
Import-PSSession $session –AllowClobber
Set-ExecutionPolicy RemoteSigned
Connect-MsolService –Credential $c
$fichHTML = "C:DevPowerShelltempHTMLsignature_YosDaysMontPellierDYNAMIQUE.html"
# On applique la signature spécifique à tous les utilisateurs
Get-MsolUser |
ForEach {
$signHTML = (Get-Content $fichHTML) -f $_.DisplayName, $_.Title, `
$_.MobilePhone, $_.UserPrincipalName
Set-MailboxMessageConfiguration `
–Identity $_.UserPrincipalName `
-AutoAddSignature $True `
-SignatureHtml $signHTML
}
- 37. yOS-Tour - yOS-Day ©2015. All rights reserved.
http://technet.microsoft.com/en-us/office/dn788774
Technet – Bible technique
- 38. yOS-Tour - yOS-Day ©2015. All rights reserved.
Technet Microsoft
https://technet.microsoft.com/fr-fr/
Active Directory Administration with Windows PowerShell
https://technet.microsoft.com/fr-fr/library/dd378937(v=ws.10).aspx
Active Directory Cmdlets in Windows PowerShell
https://technet.microsoft.com/fr-fr/library/ee617195.aspx
PowerShell Tools for Visual Studio
https://visualstudiogallery.msdn.microsoft.com/c9eb3ba8-0c59-4944-9a62-6eee37294597
Connect to Office 365 by using a single Windows PowerShell window
https://technet.microsoft.com/en-us/library/dn568015.aspx
Scripts Office 365 – Exemple Gestion Mails
http://www.sysco.ch/website/?it=101785
Use PowerShell to Manage Office 365 Users
Liens utiles
- 39. yOS-Tour - yOS-Day ©2015. All rights reserved.
Skype for Business (aka Lync Online) PowerShell
http://blogs.technet.com/b/csps/
Configuring your computer for Lync Online management
https://technet.microsoft.com/en-us/library/dn362839.aspx
Windows PowerShell Module for Lync Online
https://www.microsoft.com/en-us/download/details.aspx?id=39366
Liens utiles
- 40. yOS-Tour - yOS-Day ©2015. All rights reserved.
Twitter officiels Office 365
https://twitter.com/Office365_Tech
https://twitter.com/Office365
Twitter Benoit Jester @SPAsipe
https://twitter.com/spasipe
Twitter Etienne Bailly @etienne_bailly
https://twitter.com/etienne_bailly
Yammer IT Pro Network
https://yammer.com/itpronetwork
Twitter & Yammer utiles
- 42. yOS-Tour - yOS-Day ©2015. All rights reserved.
http://powershell.office.com
• Scripts d’exemple
• Scénarios utiles
• Aide
Coming Soon PowerShell for Office
- 45. yOS-Tour - yOS-Day ©2015. All rights reserved.
#2 – yOS-Day à Montpellier le 12 juin 2015
Merci à nos sponsors
- 46. yOS-Tour - yOS-Day ©2015. All rights reserved.
#2 – yOS-Day à Montpellier le 12 juin 2015
- 47. yOS-Tour - yOS-Day ©2015. All rights reserved.
Le yOS-Tour débarque à Lyon !!!
11 décembre 2015