Removing Old IIS Logs
Simple powershell script to remove old IIS logs (or any other file for that matter). $pathToLogs = “C:\WINDOWS\system32\LogFiles\W3SVC1″;$LogAgeTarget = 183; # Number of days of logs to keep$dteNow = Get-Date if (Test-Path $pathToLogs){ $LastWrite = $Now.AddDays(-$LogAgeTarget) $Files = Get-ChildItem $pathToLogs -include *.log -recurse | Where {$_.LastWriteTime -le “$LastWrite”} foreach [...]
Continue ReadingExchange 2007 Logs from Client Access Machines
A short script to make it a little easier to retrieve logs from several client access machines. A little quicker than using the Toolbox Message Tracking Log: $strEvent = “RECEIVE”$dteStart = “31/08/2008 12:34:00″$dteEnd = “01/09/2008 16:44:00″$strMessageSubject = “Email Account Owner”Get-ExchangeServer Where {$_.ServerRole -match ‘ClientAccess’} ForEach {Get-MessageTrackingLog -Server $_.Fqdn -EventID $strEvent -MessageSubject $strMessageSubject -Start $dteStart -End [...]
Continue ReadingAdd Exchange Snapin to Windows Powershell
Trying to run exchange-specific commands in the windows powershell returns errors so to make the windows powershell aware of the exchange commands we need to add the appropriate snap in with: Add-PSSnapin Microsoft.Exchange.Management.Powershell.Admin That line can be added at the top of any scheduled task scripts.exchange powershell scheduled tasksimport use exchange commands in windows powershelladd [...]
Continue ReadingBeginning Powershell
When writing my first powershell script to check free disk space on a dozen exchange servers I picked up a few useful things for future reference. Echoing output to the command lineA script can print/write output to stdout using Write-Host “Hello World” but this command is aliased too, so that echo “Hello World” will also [...]
Continue Reading
Recent Comments
Thanks - worked for me....
29 days agoyou can use partprobe command to eliminate the need for reboot....
50 days agoThanks alot for this simple and solid post....
56 days agoI'm using this company services (ssl2buy) since long and purchased man...
56 days ago