Monday, July 8, 2013

Powershell Script to check whether there is a file created/copied today or not

Powershell Script to check whether there is a file created/copied today or not
This script can be used to check whether there is backup activity happened or not also the presence of a newly created file .it can also incorporate with an email string to initiate an email as per the required action
Script


$today = (get-date).Date;
Get-ChildItem C:\Users\User1\ | where { $_.CreationTime.Date -eq $today };
if ($_ -eq $null)
{
Write-Host "no File"
}
else
{
Write-host $FileName}



You can change write host part with an email script
-Sachin