This repository has been archived by the owner on Apr 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Install-MicrosoftTeams.ps1
88 lines (60 loc) · 1.96 KB
/
Install-MicrosoftTeams.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<#
.SYNOPSIS
Install-MicrosoftTeams.ps1 - Microsoft Teams Desktop Client Deployment Script
.DESCRIPTION
This PowerShell script will silently install the Microsoft Teams desktop client.
The Teams client installer can be downloaded from Microsoft:
https://teams.microsoft.com/downloads
.PARAMETER SourcePath
Specifies the source path for the Microsoft Teams installer.
.EXAMPLE
.\Install-MicrosoftTeams.ps1 -Source \\mgmt\Installs\MicrosoftTeams
Installs the Microsoft Teams client from the Installs share on the server MGMT.
.NOTES
Written by: Paul Cunningham
Find me on:
* My Blog: https://paulcunningham.me
* Twitter: https://twitter.com/paulcunningham
* LinkedIn: https://au.linkedin.com/in/cunninghamp/
* Github: https://github.com/cunninghamp
Change Log
V1.00, 15/03/2017 - Initial version
#>
#requires -version 4
[CmdletBinding()]
param (
[Parameter(Mandatory=$true)]
[string]$SourcePath
)
function DoInstall {
$Installer = "$($SourcePath)\Teams_windows_x64.exe"
If (!(Test-Path $Installer)) {
throw "Unable to locate Microsoft Teams client installer at $($installer)"
}
Write-Host "Attempting to install Microsoft Teams client"
try {
$process = Start-Process -FilePath "$Installer" -ArgumentList "-s" -Wait -PassThru -ErrorAction STOP
if ($process.ExitCode -eq 0)
{
Write-Host -ForegroundColor Green "Microsoft Teams setup started without error."
}
else
{
Write-Warning "Installer exit code $($process.ExitCode)."
}
}
catch {
Write-Warning $_.Exception.Message
}
}
#Check if Office is already installed, as indicated by presence of registry key
$installpath = "$($env:LOCALAPPDATA)\Microsoft\Teams"
if (-not(Test-Path "$($installpath)\Update.exe")) {
DoInstall
}
else {
if (Test-Path "$($installpath)\.dead") {
Write-Host "Teams was previously installed but has been uninstalled. Will reinstall."
DoInstall
}
}