Simple Script to get the config file values – Exchange 2013

In a large sized environment, its a tedious job to verify the config files for any specific values, It takes a lot of manual efforts and a utter waste of time.

Just to make it simple, came up with this very basic script that can fasten this task (Still this can be enhanced 🙂 ),

  1. Create a file named Server.txt which should have the list of servers where you would want to check the config files
  2. If you wish you can even change the path as per your convenience.
  3. In this example, we tried looking for the maxRequestLength, MaxDocumentDataSize & MaxRequestLength in the web.config file.
  4. Based on your requirement, you can alter the path, file and values.

Please leave your comments or questions below.

Regards,

Ganesh G

#Script to Simple Script to get the config file values – Exchange 2013

#=========================================================

#Ganesh G

$server = Get-content “C:\Troubleshooting\Server.txt”
Foreach ($Server in $Server)
{
Write-host “$server”
Write-host “From: Exchsrvr\ClientAccess\Sync\web.config”
Select-String “\\$server\d$\Exchsrvr\ClientAccess\Sync\web.config” -pattern “maxRequestLength” | Format-List “Line”
Select-String “\\$server\d$\Exchsrvr\ClientAccess\Sync\web.config” -pattern “MaxDocumentDataSize” | Format-List “Line”
Write-host “From: Exchsrvr\FrontEnd\HttpProxy\sync\web.config”
Select-String “\\$server\d$\Exchsrvr\FrontEnd\HttpProxy\sync\web.config” -pattern “maxRequestLength” | Format-List “Line”
}

Leave a comment