Skip to content

Instantly share code, notes, and snippets.

@dizzi
Created July 31, 2009 23:16
Show Gist options
  • Save dizzi/159502 to your computer and use it in GitHub Desktop.
Save dizzi/159502 to your computer and use it in GitHub Desktop.
function writeToMonitor{
write-host LOG: Last transfer $args[0]
}
$now = Get-Date 13:00
$start = Get-Date 7:00
$end = Get-Date 20:00
if($now -gt $start -and $now -lt $end) {
$lastfile = Get-ChildItem d:\ | Sort-Object -Property LastWriteTime | Select-Object -First 1
$mins = ($(Get-Date)-$lastfile.LastWriteTime).minutes
write-host Last tranfser was ${mins}mins ago
writeToMonitor $mins
} else {
write-host We are out of opeartion window, sending fake data to monitor
writeToMonitor 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment