Merge pull request #2 from cunninghamp/development

Initial version of Install-OfficeCTR.ps1
This commit is contained in:
Paul Cunningham
2016-10-04 22:48:08 +10:00
committed by GitHub
3 changed files with 197 additions and 2 deletions

View File

@@ -0,0 +1,11 @@
#Office Click-to-Run Product IDs
Source: [Microsoft](https://support.microsoft.com/en-au/kb/2842297)
The following product IDs are supported for use in Configuration.xml files with the Office Deployment Tool.
|Product ID|Office 365 Plan|
|---|---|
|O365ProPlusRetail|Office ProPlus, Office 365 Enterprise E3, Office 365 Enterprise E5|
|O365BusinessRetail|Office 365 Business, Office 365 Business Premium|

128
Install-OfficeCTR.ps1 Normal file
View File

@@ -0,0 +1,128 @@
<#
.SYNOPSIS
Install-OfficeCTR.ps1 - Office 365 CTR Install Script
.DESCRIPTION
This PowerShell script will install Office 365 Click-to-Run on
client computers.
This script is designed to work with Office 2016 builds of
Office 365 CTR, not Office 2013.
Before using this script you should set up an shared folder for
your Office 365 CTR deployments by following the instructions
at http://practical365.com
.PARAMETER InstallRoot
Specify the UNC path to the network share that hosts the Office 365
setup and configuration files.
.PARAMETER SKU
Specify the the Office CTR SKU to deploy (e.g. ProPlus, Business)
.PARAMETER Channel
Specify the build channel to deploy (e.g. Current, Deferred)
.EXAMPLE
.\Install-OfficeCTR.ps1 -InstallRoot \\mgmt\Installs\OfficeCTR -SKU ProPlus -Channel Deferred
.NOTES
Written by: Paul Cunningham
Find me on:
* My Blog: http://paulcunningham.me
* Twitter: https://twitter.com/paulcunningham
* LinkedIn: http://au.linkedin.com/in/cunninghamp/
* Github: https://github.com/cunninghamp
For more Office 365 tips, tricks and news
check out Practical365.
* Website: http://practical365.com
* Twitter: http://twitter.com/practical365
Change Log
V1.00, 22/09/2016 - Comment
#>
#requires -version 4
[CmdletBinding()]
param (
[Parameter(Mandatory=$true)]
[string]$InstallRoot,
[Parameter(Mandatory=$true)]
[ValidateSet('Business','ProPlus', ignorecase=$true)]
[string]$SKU,
[Parameter(Mandatory=$true)]
[ValidateSet('Current','Deferred','FirstReleaseCurrent','FirstReleaseDeferred',ignorecase=$true)]
[string]$Channel
)
function DoInstall {
$ConfigurationXML = "$($InstallRoot)\$($SKU)\$($Channel)\configuration.xml"
If (!(Test-Path $ConfigurationXML)) {
throw "Unable to locate a configuration XML file at $($ConfigurationXML)"
}
$setuppath = "$($InstallRoot)\$($SKU)\$($Channel)\Setup.exe"
if (!(Test-Path $setuppath)) {
throw "Unable to locate a Setup.exe file at $($setuppath)"
}
Write-Host "Attempting to install Office 365 $($SKU) $($Channel)"
try {
$process = Start-Process -FilePath "$($InstallRoot)\$($SKU)\$($Channel)\Setup.exe" -ArgumentList "/Configure $($InstallRoot)\$($SKU)\$($Channel)\configuration.xml" -Wait -PassThru -ErrorAction STOP
if ($process.ExitCode -eq 0)
{
Write-Host -ForegroundColor Green "Office 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
$RegistryPath = 'HKLM:\SOFTWARE\Microsoft\Office\16.0\ClickToRunStore\Packages\{9AC08E99-230B-47e8-9721-4577B7F124EA}'
if (Test-Path $RegistryPath) {
#Check for children
$Item = Get-ItemProperty -Path $RegistryPath
if (!($Item.'(default)' -eq $null)) {
#Office is installed, according to registry key. Nothing further to do.
EXIT
}
else {
#Registry key exists but default value is empty, install needed
DoInstall
}
}
else {
#Registry key doesn't exist, install needed
DoInstall
}

View File

@@ -1,2 +1,58 @@
# Office-365-Deploy #Office 365 Client Deployment Scripts
Office 365 Client Deployment Scripts
This repository hosts PowerShell scripts that assist with the deployment of Office 365 client software.
The scripts included at this time are:
- Install-OfficeCTR.ps1
If you're looking for more complex, featured scripts you might be interested in [Microsoft's Office Deployment Scripts for IT Pros](http://officedev.github.io/Office-IT-Pro-Deployment-Scripts/).
##Install-OfficeCTR.ps1 - Office 365 CTR Install Script
This PowerShell script will install Office 365 Click-to-Run when it is run manually, or as a logon/startup script. Install-OfficeCTR.ps1 supports both the ProPlus and Business SKU for Office 365, as well as the four channels:
- Deferred
- Current
- First Release Deferred
- First Release Current
This script is designed to work with Office 2016 builds of Office 365 CTR, not Office 2013.
Before using this script you should set up an shared folder for your Office 365 CTR deployments by following the instructions at [Practical 365](https://practical365.com).
###Usage:
Install-OfficeCTR.ps1 uses the following parameters:
- **InstallRoot** - Specify the UNC path to the network share that hosts the Office 365
setup and configuration files.
- **SKU** - Specify the the Office CTR SKU to deploy (e.g. ProPlus, Business)
- **Channel** - Specify the build channel to deploy (e.g. Current, Deferred)
The three parameters are used by the install script to locate the appropriate setup and configuration files in your install share on the network.
Example:
```
.\Install-OfficeCTR.ps1 -InstallRoot \\mgmt\Installs\OfficeCTR -SKU ProPlus -Channel Deferred
```
The example above will look for setup and configuration files in **\\\mgmt\Installs\OfficeCTR\ProPlus\Deferred**
##Credits
Written by: Paul Cunningham
Find me on:
* My Blog: http://paulcunningham.me
* Twitter: https://twitter.com/paulcunningham
* LinkedIn: http://au.linkedin.com/in/cunninghamp/
* Github: https://github.com/cunninghamp
For more Office 365 tips, tricks and news check out Practical 365.
* Website: [http://practical365.com]()
* Twitter: [http://twitter.com/practical365]()