#region machine.config update function UpdateMachineConfig { param ([System.String]$path) Write-Host "Machine.config update started ($path)." $timeOut = "01:00:00"; $element = "system.transactions"; $xml = [xml](get-content($path)) #always backup $xml.Save($path+ ".backup") $conf = $xml.configuration if($conf[$element] -eq $null) { #Config doesn't contain system.transactions. Let's create it. $gc = $xml.CreateElement($element) $conf.AppendChild($gc) } if($conf[$element].machineSettings -eq $null) { #Config contains system.transactions, but it has no children element machineSettings. $gc = $xml.CreateElement("machineSettings") $gc.SetAttribute("maxTimeout", $timeOut) $conf[$element].AppendChild($gc) } #Just set\update timeout if all configuration exists. $conf[$element].machineSettings.maxTimeout = $timeOut; $xml.Save($path) Write-Host "Machine.config update completed ($path)." } #To increase transactions timeout to 1 hour, needs to add or update following configuration: # # # $path = [System.Runtime.InteropServices.RuntimeEnvironment]::SystemConfigurationFile; $path32 = ""; $path64 = ""; if ($path.Contains("Framework64")) { #64 $path32 = $path.Replace("Framework64", "Framework"); $path64 = $path; } else { #32 $path32 = $path; $path64 = $path.Replace("Framework", "Framework64"); } if (Test-Path $path32) { UpdateMachineConfig $path32 } if (Test-Path $path64) { UpdateMachineConfig $path64 } #endregion