#---------------------------------------------------------------#
#Script Ttile : deleting the 90 days old log files from one server
# Scrit Author : KRR
#---------------------------------------------------------------#
$SPLogs = "C:\logs" # SharePoint log file location
$limit = (Get-Date).AddDays(-90) #log file age
try
{
write-host "SharePoint ULS logs are deleting!!!!" -ForegroundColor Yellow -BackgroundColor Black
Get-ChildItem $SPLogs -Recurse |where-object{$_.CreationTime -lt $limit} | Remove-Item
write-host "SharePoint ULS logs deleted sucessfully" -ForegroundColor green -BackgroundColor Black
}
catch
{
write-error "error deleting the log files or no files found"
}
#
Script executing fine but not deleting files inside of the folder.
ReplyDeleteAny idea why ?