Public/Get-DownOffice.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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 |
<#
.SYNOPSIS Downloads Microsoft Office 365 and Office 2019 .DESCRIPTION Downloads Microsoft Office 365 and Office 2019 Requires Internet access for downloading the updates .LINK https://www.osdeploy.com/osdupdate/docs/functions/get-downoffice .PARAMETER RepositoryRootPath Full Path of the OSDUpdate Repository .PARAMETER OfficeProduct 'Office 365 ProPlus','Office 365 Business','Office 2019 ProPlus','Office 2019 Standard' Defaults to Office 365 ProPlus .PARAMETER UpdateChannel Insiders, Monthly, SAC, SACT Defaults to SAC .PARAMETER OfficeArch 32 or 64 Defaults to 64 .PARAMETER LanguageId Defaults to en-us .PARAMETER ProofingTools Defaults to en-us .PARAMETER XmlOnly Creates an XML for use with ODT to manually download later #> function Get-DownOffice { [CmdletBinding()] PARAM ( [Parameter(Mandatory = $True)] [string]$RepositoryRootPath, #=================================================================================================== # Office Download #=================================================================================================== [ValidateSet( 'Office 365 ProPlus', 'Office 365 Business', 'Office 2019 ProPlus', 'Office 2019 Standard')] [string]$OfficeProduct = 'Office 365 ProPlus', [ValidateSet( 'Insiders', 'Monthly', 'SAC', 'SACT' )] [string]$UpdateChannel = 'SAC', [ValidateSet('64','32')] [string]$OfficeArch = '64', #=================================================================================================== # LanguageId # https://docs.microsoft.com/en-us/DeployOffice/overview-of-deploying-languages-in-office-365-proplus #=================================================================================================== [ValidateSet( 'af-za', 'ar-sa', 'as-in', 'az-Latn-az', 'bg-bg', 'bn-bd', 'bn-in', 'bs-latn-ba', 'ca-es', 'ca-es-valencia', 'cs-cz', 'Culture (ll-cc)', 'cy-gb', 'da-dk', 'de-de', 'el-gr', 'en-us', 'es-es', 'et-ee', 'eu-es', 'fa-ir', 'fi-fi', 'fr-fr', 'ga-ie', 'gd-gb', 'gl-es', 'gu-in', 'ha-Latn-ng', 'he-il', 'hi-in', 'hr-hr', 'hu-hu', 'hy-am', 'id-id', 'ig-ng', 'is-is', 'it-it', 'ja-jp', 'ka-ge', 'kk-kz', 'kn-in', 'kok-in', 'ko-kr', 'ky-kg', 'lb-lu', 'lt-lt', 'lv-lv', 'mi-nz', 'mk-mk', 'ml-in', 'mr-in', 'ms-my', 'mt-mt', 'nb-no', 'ne-np', 'nl-nl', 'nn-no', 'nso-za', 'or-in', 'pa-in', 'pl-pl', 'ps-af', 'pt-br', 'pt-pt', 'rm-ch', 'ro-ro', 'ru-ru', 'rw-rw', 'si-lk', 'sk-sk', 'sl-si', 'sq-al', 'sr-cyrl-ba', 'sr-cyrl-rs', 'sr-latn-rs', 'sv-se', 'sw-ke', 'ta-in', 'te-in', 'th-th', 'tn-za', 'tr-tr', 'tt-ru', 'uk-ua', 'ur-pk', 'uz-Latn-uz', 'vi-vn', 'wo-sn', 'xh-za', 'yo-ng', 'zh-cn', 'zh-tw', 'zu-za')] [string]$LanguageId = 'en-US', [ValidateSet( 'af-za', 'ar-sa', 'as-in', 'az-Latn-az', 'bg-bg', 'bn-bd', 'bn-in', 'bs-latn-ba', 'ca-es', 'ca-es-valencia', 'cs-cz', 'Culture (ll-cc)', 'cy-gb', 'da-dk', 'de-de', 'el-gr', 'en-us', 'es-es', 'et-ee', 'eu-es', 'fa-ir', 'fi-fi', 'fr-fr', 'ga-ie', 'gd-gb', 'gl-es', 'gu-in', 'ha-Latn-ng', 'he-il', 'hi-in', 'hr-hr', 'hu-hu', 'hy-am', 'id-id', 'ig-ng', 'is-is', 'it-it', 'ja-jp', 'ka-ge', 'kk-kz', 'kn-in', 'kok-in', 'ko-kr', 'ky-kg', 'lb-lu', 'lt-lt', 'lv-lv', 'mi-nz', 'mk-mk', 'ml-in', 'mr-in', 'ms-my', 'mt-mt', 'nb-no', 'ne-np', 'nl-nl', 'nn-no', 'nso-za', 'or-in', 'pa-in', 'pl-pl', 'ps-af', 'pt-br', 'pt-pt', 'rm-ch', 'ro-ro', 'ru-ru', 'rw-rw', 'si-lk', 'sk-sk', 'sl-si', 'sq-al', 'sr-cyrl-ba', 'sr-cyrl-rs', 'sr-latn-rs', 'sv-se', 'sw-ke', 'ta-in', 'te-in', 'th-th', 'tn-za', 'tr-tr', 'tt-ru', 'uk-ua', 'ur-pk', 'uz-Latn-uz', 'vi-vn', 'wo-sn', 'xh-za', 'yo-ng', 'zh-cn', 'zh-tw', 'zu-za')] [string]$ProofingTools = 'en-US', [switch]$XmlOnly ) #=================================================================================================== # OfficeODT #=================================================================================================== Write-Host '========================================================================================' -ForegroundColor DarkGray Write-Verbose 'Office Deployment Tool: https://www.microsoft.com/en-us/download/details.aspx?id=49117' -Verbose $OfficeODTUrl = 'https://download.microsoft.com/download/2/7/A/27AF1BE6-DD20-4CB4-B154-EBAB8A7D4A7E/officedeploymenttool_11509-33604.exe' $OfficeODTDir = "$RepositoryRootPath\OfficeODT" $OfficeODTDownloadFile = "officedeploymenttool_11509-33604.exe" $OfficeODT = 'setup.exe' $OfficeODTFullName = "$OfficeODTDir\$OfficeODT" if (!(Test-Path "$OfficeODTFullName")) { Write-Warning "Office ODT must be downloaded and extracted to $OfficeODTFullName" Write-Verbose "Office ODT Url: $OfficeODTUrl" -Verbose Write-Verbose "Office ODT Download File: $OfficeODTDownloadFile" -Verbose Write-Verbose "Office ODT Directory: $OfficeODTDir" -Verbose Write-Verbose "Office ODT: $OfficeODTFullName" -Verbose if (!(Test-Path "$OfficeODTDir")) {New-Item "$OfficeODTDir" -ItemType Directory -Force | Out-Null} Invoke-WebRequest -Uri $OfficeODTUrl -OutFile "$OfficeODTDir\$OfficeODTDownloadFile" Start-Process "$OfficeODTDir\$OfficeODTDownloadFile" -ArgumentList "/extract:`"$OfficeODTDir`"" -Wait } if (!(Test-Path "$OfficeODTFullName")) { Write-Warning "You will need to download and extract the Office Deployment Tool to $OfficeODTFullName before using OSDUpdate OfficeDownload" Break } if ($OfficeProduct -eq 'Office 365 ProPlus') {$ODTOfficeProduct = 'O365ProPlusRetail'} if ($OfficeProduct -eq 'Office 365 Business') {$ODTOfficeProduct = 'O365BusinessRetail'} if ($OfficeProduct -eq 'Office 2019 ProPlus') { $ODTOfficeProduct = 'Standard2019Volume' $ODTChannel = 'PerpetualVL2019' } if ($OfficeProduct -eq 'Office 2019 Standard') { $ODTOfficeProduct = 'Standard2019Volume' $ODTChannel = 'PerpetualVL2019' } if ($OfficeProduct -eq 'Project 2019 Pro') { $ODTOfficeProduct = 'ProjectPro2019Volume ' $ODTChannel = 'PerpetualVL2019' } if ($OfficeProduct -eq 'Project 2019 Standard') { $ODTOfficeProduct = 'ProjectStd2019Volume' $ODTChannel = 'PerpetualVL2019' } if ($OfficeProduct -eq 'Visio 2019 Pro') { $ODTOfficeProduct = 'VisioPro2019Volume' $ODTChannel = 'PerpetualVL2019' } if ($OfficeProduct -eq 'Visio 2019 Standard') { $ODTOfficeProduct = 'VisioStd2019Volume' $ODTChannel = 'PerpetualVL2019' } if (($ODTOfficeProduct -eq 'O365ProPlusRetail') -or ($ODTOfficeProduct -eq 'O365BusinessRetail')) { if ($UpdateChannel -eq 'Insiders') {$ODTChannel = 'Insiders'} if ($UpdateChannel -eq 'Monthly') {$ODTChannel = 'Monthly'} if ($UpdateChannel -eq 'SAC') {$ODTChannel = 'Broad'} if ($UpdateChannel -eq 'SACT') {$ODTChannel = 'Targeted'} } #=================================================================================================== # OfficeDownload #=================================================================================================== if ($UpdateChannel -eq 'Monthly') { $OfficeDownload = "$OfficeProduct $OfficeArch-Bit" } else { $OfficeDownload = "$OfficeProduct $OfficeArch-Bit $UpdateChannel" } $DownloadsPath = "$RepositoryRootPath\$OfficeDownload" $ODTXml = @" <Configuration> <Add SourcePath="$DownloadsPath" OfficeClientEdition="$OfficeArch" Channel="$ODTChannel"> <Product ID="$ODTOfficeProduct"> <Language ID="$LanguageId" /> </Product> <Product ID="ProofingTools"> <Language ID="$ProofingTools" /> </Product> </Add> </Configuration> "@ if (!(Test-Path $DownloadsPath)) {New-Item $DownloadsPath -ItemType Directory -Force | Out-Null} $ODTXml | Out-File "$DownloadsPath\OSDUpdate.xml" -Encoding utf8 -Force Write-Host '========================================================================================' -ForegroundColor DarkGray Write-Verbose "Office Deployment Tool Download XML saved to $DownloadsPath\OSDUpdate.xml" -Verbose Write-Verbose "You can download $OfficeProduct manually with the following command line:" -Verbose Write-Verbose "`"$OfficeODTFullName`" /download `"$DownloadsPath\OSDUpdate.xml`"" -Verbose Write-Host '========================================================================================' -ForegroundColor DarkGray Write-Verbose "ODT SourcePath: $DownloadsPath" -Verbose Write-Verbose "ODT OfficeClientEdition: $OfficeArch" -Verbose Write-Verbose "ODT Channel: $ODTChannel" -Verbose Write-Verbose "ODT Product Id: $ODTOfficeProduct" -Verbose Write-Verbose "ODT Language Primary: $LanguageId" -Verbose Write-Verbose "ODT Proofing Tools: $ProofingTools" -Verbose Write-Verbose "Download Full Path: $DownloadsPath" -Verbose Write-Host '========================================================================================' -ForegroundColor DarkGray if (!($XmlOnly)) { Write-Verbose "Downloading ... This may take a while ..." -Verbose Start-Process -FilePath "$OfficeODTFullName" -ArgumentList "/download","`"$DownloadsPath\OSDUpdate.xml`"" -Wait Write-Host '========================================================================================' -ForegroundColor DarkGray } Write-Verbose "Complete!" -Verbose } |