OfficeDev / Office-IT-Pro-Deployment-Scripts

A collection of useful PowerShell scripts to make deploying Office 2016 and Office 365 ProPlus easier for IT Pros and administrators. If you have any feature requests or ideas for future scripts please add the idea to the issues list in this repository
http://officedev.github.io/Office-IT-Pro-Deployment-Scripts
MIT License
887 stars 840 forks source link

Option -ForceUpgrade in Set-ODTAdd is not availible #288

Open netraser opened 7 years ago

netraser commented 7 years ago

Function Set-ODTAdd

Add following under OfficeMgmtCOM

[Parameter(ValueFromPipelineByPropertyName=$true)]
[System.Nullable[bool]] $ForceUpgrade = $NULL,


if ($ForceUpgrade -ne $NULL) {
           if ($ForceUpgrade) {
             $ConfigFile.Configuration.Add.SetAttribute("ForceUpgrade", "True") | Out-Null
             WriteToLogFile -LNumber $(LINENUM) -FName $currentFileName -ActionError "ForceUpgrade set to True" -LogFilePath $LogFilePath
           } else {
             $ConfigFile.Configuration.Add.SetAttribute("ForceUpgrade", "False") | Out-Null
             WriteToLogFile -LNumber $(LINENUM) -FName $currentFileName -ActionError "ForceUpgrade set to False" -LogFilePath $LogFilePath
           }
        } else {
          if ($PSBoundParameters.ContainsKey('ForceUpgrade')) {
              $ConfigFile.Configuration.Add.RemoveAttribute("ForceUpgrade")
              WriteToLogFile -LNumber $(LINENUM) -FName $currentFileName -ActionError "ForceUpgrade attribute removed" -LogFilePath $LogFilePath
          }
        }