function Rename-NewLogConfig { <# .SYNOPSIS Rename new.log4net.config to log4net.config #> [CmdletBinding()] Param() $logLead = Get-LogLeadName $foldersWithoutLog4Net = (Get-ChildItem $basePath | Where-Object {$_.PSIsContainer -eq $true} | Where-Object {(Get-ChildItem $_.FullName | Where-Object {$_.Name -eq "log4net.config"}).Count -eq 0}) if (Test-IsCollectionNullOrEmpty $foldersWithoutLog4Net) { Write-Output ("$logLead : Found log4net.config in all folders under {0}" -f $basePath) return } foreach ($folder in $foldersWithoutLog4Net | Where-Object {$_.Name -notmatch "Shared"}) { $newConfigPath = Join-Path $folder.FullName "new.log4net.config" if (!(Test-Path $newConfigPath)) { Write-Warning ("$logLead : Folder {0} does not have log4net.config or a new.log4net.config. This needs manual review" -f $folder.FullName) continue } $outFile = Join-Path $folder.FullName "log4net.config" Write-Output ("$logLead : Copying file {0} to {1}" -f $newConfigPath, $outFile) [System.IO.File]::Copy($newConfigPath, $outFile) } }