cloud/modules/m365.psm1
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 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 |
<#
.SYNOPSIS OSDCloud Cloud Module for functions.osdcloud.com .DESCRIPTION OSDCloud Cloud Module for functions.osdcloud.com .NOTES This module is designed for OOBE .LINK https://raw.githubusercontent.com/OSDeploy/OSD/master/cloud/modules/M365.psm1 .EXAMPLE Invoke-Expression (Invoke-RestMethod -Uri 'https://raw.githubusercontent.com/OSDeploy/OSD/master/cloud/modules/M365.psm1') #> #================================================= #region Functions function osdcloud-InstallM365 { <#Office 365 Installer Script 2022.08.04 - Stole Script & Modified - https://github.com/gwblok/garytown/blob/master/Office365/o365_install.ps1 - Modified for Clean Installs only - Modified to use with Intune instead of CM #> [CmdletBinding(DefaultParameterSetName="Office Options")] param ( [Parameter(Mandatory=$false, ParameterSetName='Office Options')][switch] $Access, [Parameter(Mandatory=$false, ParameterSetName='Office Options')][switch] $ProjectPro, [Parameter(Mandatory=$false, ParameterSetName='Office Options')][switch] $VisioPro, [Parameter(Mandatory=$false, ParameterSetName='Office Options')][switch] $ProjectStd, [Parameter(Mandatory=$false, ParameterSetName='Office Options')][switch] $VisioStd, [Parameter(Mandatory=$false, ParameterSetName='Office Options')][switch] $AccessRuntime, [Parameter(Mandatory=$false, ParameterSetName='Office Options')][switch] $ExcludePublisher, [Parameter(Mandatory=$false, ParameterSetName='Office Options')][switch] $ExcludeOneNote, [Parameter(Mandatory=$false, ParameterSetName='Office Options')][switch] $ExcludeSkype, [Parameter(Mandatory=$false, ParameterSetName='Office Options')][switch] $ExcludeOutlook, [Parameter(Mandatory=$false, ParameterSetName='Office Options')][switch] $ExcludePowerPoint, [Parameter(Mandatory=$false, ParameterSetName='Office Options')][switch] $ExcludeBing, [Parameter(Mandatory=$false, ParameterSetName='Office Options')][switch] $SharedComputerLicensing, [Parameter(Mandatory=$false, ParameterSetName='Office Options')][switch] $AUTOACTIVATE, [Parameter(Mandatory=$false, ParameterSetName='Office Options')][switch] $PinIconsToTaskbar, [Parameter(Mandatory=$false, ParameterSetName='Office Options')][switch] $DeviceBasedLicensing, [Parameter(Mandatory=$false, ParameterSetName='Office Options')][switch] $Update, [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][ValidateSet("BetaChannel", "CurrentPreview", "Current", "MonthlyEnterprise", "SemiAnnualPreview", "SemiAnnual", "Broad", "Targeted")][string]$Channel, [Parameter(Mandatory=$false)][ValidateNotNullOrEmpty()][ValidateSet("en-us", "fr-fr", "zh-cn", "zh-tw", "de-de", "it-it")][string]$Language, [Parameter(Mandatory=$false)][switch]$SetLanguageDefault, [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string]$CompanyValue, [Parameter(Mandatory=$false)][switch]$BuildConfigXMLOnly ) ############################################################################# #If Powershell is running the 32-bit version on a 64-bit machine, we #need to force powershell to run in 64-bit mode . ############################################################################# if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { write-warning "Y'arg Matey, we're off to 64-bit land....." if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $SourceDir = Get-Location $O365Cache = "C:\ProgramData\M365_Cache" if (!(Test-Path -Path $O365Cache)){New-Item -Path $O365Cache -ItemType Directory -Force | Out-Null} $RegistryPath = "HKLM:\SOFTWARE\SWD\M365" #Sets Registry Location used for Toast Notification $ScriptVer = "22.08.04.01" $ComputerModel = (Get-WmiObject -Class:Win32_ComputerSystem).Model $LicenseShare = '\\src\src$\Office365_Shared_license' $M365Staging = "$env:TEMP\M365Temp" if (!(Test-Path -Path $M365Staging)){New-Item -Path $M365Staging -ItemType Directory -Force | Out-Null} $ODTURL = "https://download.microsoft.com/download/2/7/A/27AF1BE6-DD20-4CB4-B154-EBAB8A7D4A7E/officedeploymenttool_15330-20230.exe" Invoke-WebRequest -UseBasicParsing -Uri $ODTURL -OutFile "$env:TEMP\ODT.exe" Start-Process -FilePath "$env:TEMP\ODT.exe" -ArgumentList "/extract:$($M365Staging) /quiet" -Wait #region: CMTraceLog Function formats logging in CMTrace style function Write-CMTraceLog { [CmdletBinding()] Param ( [Parameter(Mandatory=$false)] $Message, [Parameter(Mandatory=$false)] $ErrorMessage, [Parameter(Mandatory=$false)] $Component = "Office365", [Parameter(Mandatory=$false)] [int]$Type, [Parameter(Mandatory=$false)] $LogFile = "C:\OSDCloud\Logs\M365_Install.log" ) <# Type: 1 = Normal, 2 = Warning (yellow), 3 = Error (red) #> $Time = Get-Date -Format "HH:mm:ss.ffffff" $Date = Get-Date -Format "MM-dd-yyyy" if ($ErrorMessage -ne $null) {$Type = 3} if ($Component -eq $null) {$Component = " "} if ($Type -eq $null) {$Type = 1} $LogMessage = "<![LOG[$Message $ErrorMessage" + "]LOG]!><time=`"$Time`" date=`"$Date`" component=`"$Component`" context=`"`" type=`"$Type`" thread=`"`" file=`"`">" $LogMessage | Out-File -Append -Encoding UTF8 -FilePath $LogFile } #Used to set Exit Code in way that CM registers function ExitWithCode { param ( $exitcode ) $host.SetShouldExit($exitcode) exit } Write-CMTraceLog -Message "=====================================================" -Type 1 -Component "o365script" Write-CMTraceLog -Message "Starting Script version $ScriptVer..." -Type 1 -Component "o365script" Write-CMTraceLog -Message "=====================================================" -Type 1 -Component "o365script" Write-CMTraceLog -Message "Running Script in Install Mode" -Type 1 -Component "o365script" $CurrentPreview = "http://officecdn.microsoft.com/pr/64256afe-f5d9-4f86-8936-8840a6a4f5be" $Current = "http://officecdn.microsoft.com/pr/492350f6-3a01-4f97-b9c0-c7c6ddf67d60" $MonthlyEnterprise = "http://officecdn.microsoft.com/pr/55336b82-a18d-4dd6-b5f6-9e5095c314a6" $SemiAnnualPreview = "http://officecdn.microsoft.com/pr/b8f9b850-328d-4355-9145-c59439a0c4cf" $SemiAnnual = "http://officecdn.microsoft.com/pr/7ffbc6bf-bc32-4f92-8982-f9dd17fd3114" #Create XML (Configuration.XML) if Install Mode (Not PreCache Mode) [XML]$XML = @" <Configuration Host="cm"> <Info Description="Customized Office 365" /> <Add OfficeClientEdition="64" Channel="SemiAnnual" ForceUpgrade="TRUE"> <Product ID="O365ProPlusRetail"> <Language ID="en-us" /> <ExcludeApp ID="Groove" /> <ExcludeApp ID="OneDrive" /> <ExcludeApp ID="Teams" /> </Product> </Add> <Property Name="SharedComputerLicensing" Value="0" /> <Property Name="PinIconsToTaskbar" Value="FALSE" /> <Property Name="SCLCacheOverride" Value="0" /> <Property Name="AUTOACTIVATE" Value="1" /> <Property Name="FORCEAPPSHUTDOWN" Value="TRUE" /> <Property Name="DeviceBasedLicensing" Value="0" /> <RemoveMSI /> <AppSettings> <Setup Name="Company" Value="Your Company Here" /> <User Key="software\microsoft\office\16.0\excel\options" Name="defaultformat" Value="51" Type="REG_DWORD" App="excel16" Id="L_SaveExcelfilesas" /> <User Key="software\microsoft\office\16.0\powerpoint\options" Name="defaultformat" Value="27" Type="REG_DWORD" App="ppt16" Id="L_SavePowerPointfilesas" /> <User Key="software\microsoft\office\16.0\word\options" Name="defaultformat" Value="" Type="REG_SZ" App="word16" Id="L_SaveWordfilesas" /> </AppSettings> <Display Level="None" AcceptEULA="TRUE" /> </Configuration> "@ #Temporary until the Channel names are all figured out if ($Channel -eq "SemiAnnual"){$Channel = "Broad"} if ($Channel -eq "SemiAnnualPreview"){$Channel = "Targeted"} #Change Channel $xml.Configuration.Add.SetAttribute("Channel","$Channel") Write-CMTraceLog -Message "Setting Office Channel to $Channel" -Type 1 -Component "o365script" $XML.Configuration.AppSettings.Setup.SetAttribute("Value", "$CompanyValue") Write-CMTraceLog -Message "Setting Setup Company name to $CompanyValue" -Type 1 -Component "o365script" if ($SharedComputerLicensing) { #Change SharedComputerLicensing to 1 ($xml.Configuration.Property | Where-Object {$_.Name -eq "SharedComputerLicensing"}).SetAttribute("Value","1") } if ($AUTOACTIVATE) { #Change AUTOACTIVATE to 1 ($xml.Configuration.Property | Where-Object {$_.Name -eq "AUTOACTIVATE"}).SetAttribute("Value","1") } if ($PinIconsToTaskbar) { #Change PinIconsToTaskbar to TRUE ($xml.Configuration.Property | Where-Object {$_.Name -eq "PinIconsToTaskbar"}).SetAttribute("Value","TRUE") } if ($DeviceBasedLicensing) { #Change DeviceBasedLicensing to 1 ($xml.Configuration.Property | Where-Object {$_.Name -eq "DeviceBasedLicensing"}).SetAttribute("Value","1") } #Add Project Pro to XML if Previously Installed or Called from Param if ($PP -or $ProjectPro) { $newProductElement = $xml.CreateElement("Product") $newProductApp = $xml.Configuration.Add.AppendChild($newProductElement) $newProductApp.SetAttribute("ID","ProjectPro2019Volume") $newProductApp.SetAttribute("PIDKEY","B4NPR-3FKK7-T2MBV-FRQ4W-PKD2B") $newXmlNameElement = $newProductElement.AppendChild($xml.CreateElement("Language")) $newXmlNameElement.SetAttribute("ID","en-us") $newXmlNameElement = $newProductElement.AppendChild($xml.CreateElement("ExcludeApp")) $newXmlNameElement.SetAttribute("ID","Groove") $newXmlNameElement = $newProductElement.AppendChild($xml.CreateElement("ExcludeApp")) $newXmlNameElement.SetAttribute("ID","OneDrive") $newXmlNameElement = $newProductElement.AppendChild($xml.CreateElement("ExcludeApp")) $newXmlNameElement.SetAttribute("ID","Teams") Write-CMTraceLog -Message "Adding Project Pro to Install XML" -Type 1 -Component "o365script" } #Add Visio Pro to XML if Previously Installed or Called from Param if ($VP -or $VisioPro) { $newProductElement = $xml.CreateElement("Product") $newProductApp = $xml.Configuration.Add.AppendChild($newProductElement) $newProductApp.SetAttribute("ID","VisioPro2019Volume") $newProductApp.SetAttribute("PIDKEY","9BGNQ-K37YR-RQHF2-38RQ3-7VCBB") $newXmlNameElement = $newProductElement.AppendChild($xml.CreateElement("Language")) $newXmlNameElement.SetAttribute("ID","en-us") $newXmlNameElement = $newProductElement.AppendChild($xml.CreateElement("ExcludeApp")) $newXmlNameElement.SetAttribute("ID","Groove") $newXmlNameElement = $newProductElement.AppendChild($xml.CreateElement("ExcludeApp")) $newXmlNameElement.SetAttribute("ID","OneDrive") $newXmlNameElement = $newProductElement.AppendChild($xml.CreateElement("ExcludeApp")) $newXmlNameElement.SetAttribute("ID","Teams") Write-CMTraceLog -Message "Adding Visio Pro to Install XML" -Type 1 -Component "o365script" } #Add Project Standard to XML if Previously Installed or Called from Param if ($PS -or $ProjectStd) { $newProductElement = $xml.CreateElement("Product") $newProductApp = $xml.Configuration.Add.AppendChild($newProductElement) $newProductApp.SetAttribute("ID","ProjectStd2019Volume") $newProductApp.SetAttribute("PIDKEY","C4F7P-NCP8C-6CQPT-MQHV9-JXD2M") $newXmlNameElement = $newProductElement.AppendChild($xml.CreateElement("Language")) $newXmlNameElement.SetAttribute("ID","en-us") $newXmlNameElement = $newProductElement.AppendChild($xml.CreateElement("ExcludeApp")) $newXmlNameElement.SetAttribute("ID","Groove") $newXmlNameElement = $newProductElement.AppendChild($xml.CreateElement("ExcludeApp")) $newXmlNameElement.SetAttribute("ID","OneDrive") $newXmlNameElement = $newProductElement.AppendChild($xml.CreateElement("ExcludeApp")) $newXmlNameElement.SetAttribute("ID","Teams") Write-CMTraceLog -Message "Adding Project Standard to Install XML" -Type 1 -Component "o365script" } #Add Visio Standard to XML if Previously Installed or Called from Param if ($VS -or $VisioStd) { $newProductElement = $xml.CreateElement("Product") $newProductApp = $xml.Configuration.Add.AppendChild($newProductElement) $newProductApp.SetAttribute("ID","VisioStd2019Volume") $newProductApp.SetAttribute("PIDKEY","7TQNQ-K3YQQ-3PFH7-CCPPM-X4VQ2") $newXmlNameElement = $newProductElement.AppendChild($xml.CreateElement("Language")) $newXmlNameElement.SetAttribute("ID","en-us") $newXmlNameElement = $newProductElement.AppendChild($xml.CreateElement("ExcludeApp")) $newXmlNameElement.SetAttribute("ID","Groove") $newXmlNameElement = $newProductElement.AppendChild($xml.CreateElement("ExcludeApp")) $newXmlNameElement.SetAttribute("ID","OneDrive") $newXmlNameElement = $newProductElement.AppendChild($xml.CreateElement("ExcludeApp")) $newXmlNameElement.SetAttribute("ID","Teams") Write-CMTraceLog -Message "Adding Visio Standard to Install XML" -Type 1 -Component "o365script" } #Add Access Runtime if Called from Param - Changed to ALWAYS append this. if ($AccessRuntime) { $newProductElement = $xml.CreateElement("Product") $newProductApp = $xml.Configuration.Add.AppendChild($newProductElement) $newProductApp.SetAttribute("ID","AccessRuntimeRetail") $newXmlNameElement = $newProductElement.AppendChild($xml.CreateElement("Language")) $newXmlNameElement.SetAttribute("ID","en-us") $newXmlNameElement = $newProductElement.AppendChild($xml.CreateElement("ExcludeApp")) $newXmlNameElement.SetAttribute("ID","Groove") $newXmlNameElement = $newProductElement.AppendChild($xml.CreateElement("ExcludeApp")) $newXmlNameElement.SetAttribute("ID","OneDrive") $newXmlNameElement = $newProductElement.AppendChild($xml.CreateElement("ExcludeApp")) $newXmlNameElement.SetAttribute("ID","Teams") Write-CMTraceLog -Message "Adding Access Runtime to Install XML" -Type 1 -Component "o365script" } #Don't Remove Access from XML if Previously Installed or Called from Param if (!($Access)) { $newProductAttributes = $xml.Configuration.Add.Product foreach ($newproduct in $newProductAttributes) { $newXmlNameElement = $newproduct.AppendChild($xml.CreateElement("ExcludeApp")) $newXmlNameElement.SetAttribute("ID","Access") } Write-CMTraceLog -Message "Removing Access from Install XML" -Type 1 -Component "o365script" } else{Write-CMTraceLog -Message "Adding Access To Install XML" -Type 1 -Component "o365script"} #If Exclude OneNote if ($ExcludeOneNote) { $newProductAttributes = $xml.Configuration.Add.Product foreach ($newproduct in $newProductAttributes) { $newXmlNameElement = $newproduct.AppendChild($xml.CreateElement("ExcludeApp")) $newXmlNameElement.SetAttribute("ID","OneNote") } Write-CMTraceLog -Message "Removing OneNote from Install XML" -Type 1 -Component "o365script" } #If Exclude Skype if ($ExcludeSkype) { $newProductAttributes = $xml.Configuration.Add.Product foreach ($newproduct in $newProductAttributes) { $newXmlNameElement = $newproduct.AppendChild($xml.CreateElement("ExcludeApp")) $newXmlNameElement.SetAttribute("ID","lync") } Write-CMTraceLog -Message "Removing Skype from Install XML" -Type 1 -Component "o365script" } #If Exclude Publisher if ($ExcludePublisher) { $newProductAttributes = $xml.Configuration.Add.Product foreach ($newproduct in $newProductAttributes) { $newXmlNameElement = $newproduct.AppendChild($xml.CreateElement("ExcludeApp")) $newXmlNameElement.SetAttribute("ID","Publisher") } Write-CMTraceLog -Message "Removing Publisher from Install XML" -Type 1 -Component "o365script" } #If Exclude Outlook if ($ExcludeOutlook) { $newProductAttributes = $xml.Configuration.Add.Product foreach ($newproduct in $newProductAttributes) { $newXmlNameElement = $newproduct.AppendChild($xml.CreateElement("ExcludeApp")) $newXmlNameElement.SetAttribute("ID","Outlook") } Write-CMTraceLog -Message "Removing Outlook from Install XML" -Type 1 -Component "o365script" } #If Exclude PowerPoint if ($ExcludePowerPoint) { $newProductAttributes = $xml.Configuration.Add.Product foreach ($newproduct in $newProductAttributes) { $newXmlNameElement = $newproduct.AppendChild($xml.CreateElement("ExcludeApp")) $newXmlNameElement.SetAttribute("ID","PowerPoint") } Write-CMTraceLog -Message "Removing PowerPoint from Install XML" -Type 1 -Component "o365script" } #If Exclude Bing if ($ExcludeBing) { $newProductAttributes = $xml.Configuration.Add.Product foreach ($newproduct in $newProductAttributes) { $newXmlNameElement = $newproduct.AppendChild($xml.CreateElement("ExcludeApp")) $newXmlNameElement.SetAttribute("ID","Bing") } Write-CMTraceLog -Message "Removing BIng from Install XML" -Type 1 -Component "o365script" } #Adds Uninstall for other Versions of Visio & Project if triggering Visio / Project if ($ProjectStd) #If Choosing to Install Project Standard, Added XML to Remove Project Pro { $XMLRemove=$XML.CreateElement("Remove") $XML.Configuration.appendChild($XMLRemove) $XMLProduct=$XMLRemove.appendChild($XML.CreateElement("Product")) $newProductElement = $xml.CreateElement("Product") $newProductApp = $xml.Configuration.Remove.AppendChild($XMLProduct) $newProductApp.SetAttribute("ID","ProjectPro2019Volume") #$newProductApp.SetAttribute("PIDKEY","WGT24-HCNMF-FQ7XH-6M8K7-DRTW9") $newXmlNameElement = $newProductElement.AppendChild($xml.CreateElement("Language")) $newXmlNameElement.SetAttribute("ID","en-us") } #Adds Uninstall for other Versions of Visio & Project if triggering Visio / Project if ($VisioStd) #If Choosing to Install Visio Standard, Added XML to Remove Visio Pro { $XMLRemove=$XML.CreateElement("Remove") $XML.Configuration.appendChild($XMLRemove) $XMLProduct=$XMLRemove.appendChild($XML.CreateElement("Product")) $newProductElement = $xml.CreateElement("Product") $newProductApp = $xml.Configuration.Remove.AppendChild($XMLProduct) $newProductApp.SetAttribute("ID","VisioPro2019Volume") #$newProductApp.SetAttribute("PIDKEY","69WXN-MBYV6-22PQG-3WGHK-RM6XC") $newXmlNameElement = $newProductElement.AppendChild($xml.CreateElement("Language")) $newXmlNameElement.SetAttribute("ID","en-us") } #Adds Uninstall for other Versions of Visio & Project if triggering Visio / Project if ($ProjectPro) #If Choosing to Install Project Pro, Added XML to Remove Project Standard { $XMLRemove=$XML.CreateElement("Remove") $XML.Configuration.appendChild($XMLRemove) $XMLProduct=$XMLRemove.appendChild($XML.CreateElement("Product")) $newProductElement = $xml.CreateElement("Product") $newProductApp = $xml.Configuration.Remove.AppendChild($XMLProduct) $newProductApp.SetAttribute("ID","ProjectStd2019Volume") #$newProductApp.SetAttribute("PIDKEY","WGT24-HCNMF-FQ7XH-6M8K7-DRTW9") $newXmlNameElement = $newProductElement.AppendChild($xml.CreateElement("Language")) $newXmlNameElement.SetAttribute("ID","en-us") } #Adds Uninstall for other Versions of Visio & Project if triggering Visio / Project if ($VisioPro) #If Choosing to Install Visio Pro, Added XML to Remove Visio { $XMLRemove=$XML.CreateElement("Remove") $XML.Configuration.appendChild($XMLRemove) $XMLProduct=$XMLRemove.appendChild($XML.CreateElement("Product")) $newProductElement = $xml.CreateElement("Product") $newProductApp = $xml.Configuration.Remove.AppendChild($XMLProduct) $newProductApp.SetAttribute("ID","VisioStd2019Volume") #$newProductApp.SetAttribute("PIDKEY","69WXN-MBYV6-22PQG-3WGHK-RM6XC") $newXmlNameElement = $newProductElement.AppendChild($xml.CreateElement("Language")) $newXmlNameElement.SetAttribute("ID","en-us") } <#add additional languages to download In the install command, if you leave out -Language, it will default to en-us If you pick a different language like fr-fr, it will set that as default, but still include en-us #> if ($Language) { Write-CMTraceLog -Message "Language Param detected, added $Language to XML" -Type 1 -Component "o365script" if ($SetLanguageDefault)#Set Default language to the Language Specified { Write-CMTraceLog -Message " LanguageDefault Param detected, set $Language to Default" -Type 1 -Component "o365script" $CurrentProductAttributeLang = $xml.Configuration.Add.Product foreach ($currentproduct in $CurrentProductAttributeLang) { $newXmlNameElement = $currentproduct.Language $newXmlNameElement.SetAttribute("ID","$Language") } #Include English in the install if you picked a different language as your default if (!($Language -eq "en-us")) { Write-CMTraceLog -Message " LanguageDefault Param detected, appending en-us to XML" -Type 1 -Component "o365script" $newProductAttributeLang = $xml.Configuration.Add.Product foreach ($newproduct in $newProductAttributeLang) { $newXmlNameElement = $newproduct.AppendChild($xml.CreateElement("Language")) $newXmlNameElement.SetAttribute("ID","en-us") } } } else #Append Language, leaving English as Default { Write-CMTraceLog -Message " LanguageDefault Param NOT detected, appending $Language to XML" -Type 1 -Component "o365script" $newProductAttributeLang = $xml.Configuration.Add.Product foreach ($newproduct in $newProductAttributeLang) { $newXmlNameElement = $newproduct.AppendChild($xml.CreateElement("Language")) $newXmlNameElement.SetAttribute("ID","$Language") } } } Write-CMTraceLog -Message "Creating XML file: $("$O365Cache\configuration.xml")" -Type 1 -Component "o365script" $xml.Save("$O365Cache\configuration.xml") if (!($BuildConfigXMLOnly)) { Write-CMTraceLog -Message "Starting Office 365 Install" -Type 1 -Component "o365script" $InstallOffice = Start-Process -FilePath $M365Staging\setup.exe -ArgumentList "/configure $O365Cache\configuration.xml" -Wait -PassThru -WindowStyle Hidden $OfficeInstallCode = $InstallOffice.ExitCode Write-CMTraceLog -Message "Finished Office Install with code: $OfficeInstallCode" -Type 1 -Component "o365script" if ($OfficeInstallCode -eq "-2147023294") { Write-CMTraceLog -Message "End User Clicked Cancel when prompted to close applications" -Type 1 -Component "o365script" Write-CMTraceLog -Message "Exit Script with code: $OfficeInstallCode" -Type 1 -Component "o365script" #ExitWithCode -exitcode $OfficeInstallCode } Write-CMTraceLog -Message "Exit Script with code: $OfficeInstallCode" -Type 1 -Component "o365script" #ExitWithCode -exitcode $OfficeInstallCode } } #endregion #================================================= |