forked from directorcia/Office365
-
Notifications
You must be signed in to change notification settings - Fork 1
/
o365-setup.ps1
65 lines (53 loc) · 3.21 KB
/
o365-setup.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<# CIAOPS
Script provided as is. Use at own risk. No guarantees or warranty provided.
## Description - Install the relevant Microsoft Online PowerShell modules
Source - https://github.com/directorcia/Office365/blob/master/o365-setup.ps1
Prerequisites = 1
1. Run PowerShell environment as an administrator
More scripts available by joining http://www.ciaopspatron.com
#>
## Variables
$systemmessagecolor = "cyan"
$processmessagecolor = "green"
$errormessagecolor = "red"
## If you have running scripts that don't have a certificate, run this command once to disable that level of security
## set-executionpolicy -executionpolicy bypass -scope currentuser -force
Clear-Host
write-host -foregroundcolor $systemmessagecolor "Start Script`n"
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
If ($currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
write-host -foregroundcolor $processmessagecolor "NuGet provider"
Install-PackageProvider -Name NuGet -Force -confirm:$false
write-host -foregroundcolor $processmessagecolor "Install Azure AD module"
Install-Module -Name AzureAD -force -confirm:$false
write-host -foregroundcolor $processmessagecolor "Install Azure Information Protection module"
Install-module -name aipservice -Force -confirm:$false
## Install-Module -Name AADRM -force ## Support for the AADRM module ends July 15, 2020
write-host -foregroundcolor $processmessagecolor "Install Teams Module"
Install-Module -Name MicrosoftTeams -Force -confirm:$false
write-host -foregroundcolor $processmessagecolor "Install SharePoint Online module"
Install-Module -Name Microsoft.Online.SharePoint.PowerShell -force -confirm:$false
write-host -foregroundcolor $processmessagecolor "Install Microsoft Online module"
Install-Module -Name MSOnline -force -confirm:$false
write-host -foregroundcolor $processmessagecolor "Install Exchange Online V2 module"
Install-Module PowershellGet -Force -confirm:$false
Install-Module -Name ExchangeOnlineManagement -force -confirm:$false
write-host -foregroundcolor $processmessagecolor "Install Azure module"
## Old Azure module
## Install-Module -name AzureRM -Force
## New Az module
Install-Module -name Az -force -confirm:$false
write-host -foregroundcolor $processmessagecolor "Install SharePoint PnP module"
Install-Module PnP.PowerShell -Force -confirm:$false
write-host -foregroundcolor $processmessagecolor "Install Microsoft Graph Module"
Install-Module -Name Microsoft.Graph -force -confirm:$false
write-host -foregroundcolor $processmessagecolor "Install Windows Autopilot Module"
## will also update dependent AzureAD and Microsoft.Graph.Intune modules
Install-Module -Name WindowsAutoPilotIntune -force -confirm:$false
write-host -foregroundcolor $processmessagecolor "Install Centralised Add-in Deployment"
Install-module -name O365CentralizedAddInDeployment -confirm:$false
}
else {
write-host -foregroundcolor $errormessagecolor "*** ERROR *** - Please re-run PowerShell environment as Administrator`n"
}
write-host -foregroundcolor $systemmessagecolor "Script completed`n"