forked from directorcia/Office365
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patho365-update.ps1
53 lines (43 loc) · 2.28 KB
/
o365-update.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
<# CIAOPS
Script provided as is. Use at own risk. No guarantees or warranty provided.
Description - Update all the relevant Microsoft Online PowerShell modules
Source - https://github.com/directorcia/Office365/blob/master/o365-update.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 "Update Azure AD module"
Update-Module -Name AzureAD -force
write-host -foregroundcolor $processmessagecolor "Update Azure AD Right Management module"
Update-Module -Name AADRM -force
write-host -foregroundcolor $processmessagecolor "Update Teams Module"
Update-Module -Name MicrosoftTeams -Force
write-host -foregroundcolor $processmessagecolor "Update SharePoint Online module"
Update-Module -Name Microsoft.Online.SharePoint.PowerShell -force
write-host -foregroundcolor $processmessagecolor "Update Microsoft Online module"
Update-Module -Name MSOnline -force
write-host -foregroundcolor $processmessagecolor "Update Exchange Online V2 module"
Update-Module PowershellGet -Force
Update-Module -Name ExchangeOnlineManagement -force
write-host -foregroundcolor $processmessagecolor "Update Azure module"
## Old Azure module
## Update-Module -name AzureRM -Force
## New Az module
Update-Module -name Az -force
write-host -foregroundcolor $processmessagecolor "Update SharePoint PnP module"
update-Module SharePointPnPPowerShellOnline -Force
}
Else {
write-host -foregroundcolor $errormessagecolor "*** ERROR *** - Please re-run PowerShell environment as Administrator`n"
}
write-host -foregroundcolor $systemmessagecolor "Script completed`n"