-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-ringcentral.ps1
51 lines (46 loc) · 1.56 KB
/
install-ringcentral.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
# Requires -Version 3.0
$URL = "https://downloads.ringcentral.com/sp/RingCentralForWindows"
#$FolderPath = "@FolderPath@"
$FolderPath = "C:\windows\temp"
$FilePath = "$Folderpath\RingCentral.msi"
$MSILogFile = "$FolderPath\InstallLog.log"
$Arguments = @"
/c msiexec /i "$InstallerFile" /qn /norestart REBOOT=REALLYSUPPRESS /L*v "$MSILogFile"
"@
function Get-Folder {
if (!(Test-Path $FolderPath)) {
Write-Output "Creating Folder"
cmd /c "mkdir $FolderPath"
}
}
Function Get-Software {
$Installer = Get-Item "$FilePath\RingCentral.MSI" -ErrorAction SilentlyContinue
if(!($Installer)){
Write-Output "File missing. Begin downloading from $DownloadURL"
Invoke-WebRequest -uri $URL -OutFile $FilePath
return
} else {
Write-Output "Installer found."
return
}
}
Function Install-Software {
if (!(Test-Path $FilePath)) {
Write-output "Cannot complete file install. Installer is missing"
exit 1
}
$Process = Start-Process -Wait cmd -ArgumentList $Arguments -Passthru
Write-Host "Exit Code: $($Process.ExitCode)";
switch ($Process.ExitCode) {
0 { Write-Host "Success" }
3010 { Write-Host "Success. Reboot required to complete installation" }
1641 { Write-Host "Success. Installer has initiated a reboot" }
default {
Write-Host "Exit code does not indicate success"
Get-Content $MSILogFile -ErrorAction SilentlyContinue | select -Last 50
}
}
}
Get-Folder
Invoke-WebRequest -uri $url -outfile $FilePath
Install-Software