All, I have been working on extending the AutoSPInstaller, part of which was to provide configuration settings for the Diagnostic and Logging service
The AutoSPInstaller can be obtained from here: http://autospinstaller.codeplex.com/
AutoSPInstaller Automates the SharePoint 2010 build by using PowerShell and XML.
To add the diagnostic element update as follows:
Edit AutoSPInstallerInput.xml Under
<DiagnosticLogging DiagnosticLoggingDaysToKeepLog="12" DiagnosticLoggingPath="C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14LOGS" DiagnosticLoggingUsageSize="1"/>
Edit AutoSPInstallerMain.ps1 Under Function Setup-Services{ add:
Set-DiagnosticLogging ($xmlinput)
Edit AutoSPInstallerFunctions.ps1
#Region DiagnosticLogging Configuration
# ====================================
# Func: DiagnosticLogging
# Desc: Configures Diagnostic Logging
# ====================================
Function Set-DiagnosticLogging ([xml]$xmlinput)
{
Write-Host -ForegroundColor White " - Starting Diagnostic Logging Configuration."
$DiagnosticLoggingPath = $xmlinput.Configuration.Farm.DiagnosticLogging.DiagnosticLoggingPath
Write-Host -ForegroundColor White " - Starting Diagnostic Logging Configuration Path $DiagnosticLoggingPath."
$DiagnosticLoggingUsageSize = $xmlinput.Configuration.Farm.DiagnosticLogging.DiagnosticLoggingUsageSize
Write-Host -ForegroundColor White " - Starting Diagnostic Logging Configuration Usage Size $DiagnosticLoggingUsageSize."
$DiagnosticLoggingDaysToKeepLog = $xmlinput.Configuration.Farm.DiagnosticLogging.DiagnosticLoggingDaysToKeepLog
Write-Host -ForegroundColor White " - Starting Diagnostic Logging Configuration Days to Keep $DiagnosticLoggingDaysToKeepLog."
Write-Host -ForegroundColor White " - Configuring Diagnostic Logging..."
Set-SPDiagnosticConfig -LogLocation $DiagnosticLoggingPath -LogDiskSpaceUsageGB $DiagnosticLoggingUsageSize -DaysToKeepLog $DiagnosticLoggingDaysToKeepLog -LogMaxDiskSpaceUsageEnabled
Write-Host -ForegroundColor White " - Done Configuring Diagnostic Logging."
}
#EndRegion