try { Add-Type -ErrorAction SilentlyContinue -TypeDefinition @" public enum OfficeCTRVersion { Office2013, Office2016 } "@ } catch {} try { $enum = " using System; namespace Microsoft.Office { [FlagsAttribute] public enum Products { Unknown = 0, O365ProPlusRetail = 1, O365BusinessRetail = 2, VisioProRetail = 4, ProjectProRetail = 8, SPDRetail = 16, VisioProXVolume = 32, VisioStdXVolume = 64, ProjectProXVolume = 128, ProjectStdXVolume = 256, InfoPathRetail = 512, SkypeforBusinessEntryRetail = 1024, LyncEntryRetail = 2048, AccessRuntimeRetail = 4096 } } " Add-Type -TypeDefinition $enum -ErrorAction SilentlyContinue } catch {} try { $enum2 = " using System; [FlagsAttribute] public enum LogLevel { None=0, Full=1 } " Add-Type -TypeDefinition $enum2 -ErrorAction SilentlyContinue } catch {} try { Add-Type -ErrorAction SilentlyContinue -TypeDefinition @" public enum PinAction { PinToStartMenu, PinToTaskbar, UnpinFromStartMenu, UnpinFromTaskbar } "@ } catch {} function Install-OfficeClickToRun { <# .SYNOPSIS Installs Office Click-To-Run .DESCRIPTION Installs Office Click-To-Run using a specified configuration file or targetfilepath. .PARAMETER ConfigurationXML The path to a pre-configured configuration.xml file used for installation. .PARAMETER TargetFilePath If no ConfigurationXML is specified, this is the path where the generated configuration.xml will be saved. .PARAMETER PinToStart If $true, all Office apps will be pinned to the Start Menu in Windows 10. .PARAMETER OfficeVersion The version of Office Click-To-Run to install. Available options are Office2013 and Office2016. .PARAMETER WaitForInstallToFinish If $true, the PowerShell console will remain open and provide status updates until Office is finished installing. .PARAMETER PinToStartMenu Choose one or multiple Office applications to pin to the Start Menu after the installation is finished. .PARAMETER PinToTaskbar Choose one or multiple Office applications to pin to the Taskbar after the installation is finished. Pinning applications to the Taskbar in Windows 10 is not natively supported. .EXAMPLE Install-OfficeClickToRun -ConfigurationXML C:\OfficeDeployment