Added logic to skip when Office is already installed
This commit is contained in:
@@ -17,17 +17,14 @@ at http://practical365.com
|
|||||||
Specify the UNC path to the network share that hosts the Office 365
|
Specify the UNC path to the network share that hosts the Office 365
|
||||||
setup and configuration files.
|
setup and configuration files.
|
||||||
|
|
||||||
.PARAMETER OfficeVersion
|
|
||||||
Specify the Office CTR version to deploy (e.g. 2013, or 2016)
|
|
||||||
|
|
||||||
.PARAMETER SKU
|
.PARAMETER SKU
|
||||||
Specify the the Office CTR SKU to deploy (e.g. ProPlus, Business)
|
Specify the the Office CTR SKU to deploy (e.g. ProPlus, Business)
|
||||||
|
|
||||||
.PARAMETER
|
.PARAMETER Channel
|
||||||
|
Specify the build channel to deploy (e.g. Current, Deferred)
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
.\Verb-NounsAndThings.ps1
|
.\Install-OfficeCTR.ps1 -InstallRoot \\mgmt\Installs\OfficeCTR -SKU ProPlus -Channel Deferred
|
||||||
What does this example do...
|
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
Written by: Paul Cunningham
|
Written by: Paul Cunningham
|
||||||
@@ -69,6 +66,8 @@ param (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
function DoInstall {
|
||||||
|
|
||||||
$ConfigurationXML = "$($InstallRoot)\$($SKU)\$($Channel)\configuration.xml"
|
$ConfigurationXML = "$($InstallRoot)\$($SKU)\$($Channel)\configuration.xml"
|
||||||
|
|
||||||
If (!(Test-Path $ConfigurationXML)) {
|
If (!(Test-Path $ConfigurationXML)) {
|
||||||
@@ -98,3 +97,32 @@ try {
|
|||||||
catch {
|
catch {
|
||||||
Write-Warning $_.Exception.Message
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user