Difference between revisions of "Scheduling Within a PowerShell Script"

Jump to navigation Jump to search
Typo fix
(Initial creation - content from PowerShell Examples page)
 
(Typo fix)
 
Line 1: Line 1:
Script to run a function at a specific interval throughout the day
This script run's a function at a specific interval throughout the day.  The script runs as a continuous task and is a simple scheduling engine.
<source lang="powershell">
<source lang="powershell">
$start = Get-Date
$start = Get-Date
Line 23: Line 23:
function Log-Perf {
function Log-Perf {
     # Keeps track of script resource usage
     # Keeps track of script resource usage
     Log ("Perf CPU(sec): " + [Math]::Round($proc.cpu, 0) + ", Paged Mem (MB): " + [Math]::Round(($proc.pm/1024), 0) + ", WrkSet Mem (MB): " +  Math]::Round(($proc.ws/1024), 0))
     Log ("Perf CPU(sec): " + [Math]::Round($proc.cpu, 0) + ", Paged Mem (MB): " + [Math]::Round(($proc.pm/1024), 0) + ", WrkSet Mem (MB): " +  [Math]::Round(($proc.ws/1024), 0))
}
}


Navigation menu