diff --git a/Private/PCMonitor.ps1 b/Private/PCMonitor.ps1 index f7cbcd2..d16adf2 100644 --- a/Private/PCMonitor.ps1 +++ b/Private/PCMonitor.ps1 @@ -12,20 +12,29 @@ function Invoke-PCMonitor { $dogs = @() # Initialize computer sessions foreach ($comp in $comps) { + Write-Progress -Activity "Initializing sessions" -Status $comp -PercentComplete ($dogs.Length/$comps.Length) $dog = [WatchDog]::new($comp) $null = $dog.Update() $dogs += $dog } + Write-Progress -Activity "Initializing sessions" -Completed while ($true) { + $change = $false foreach ($dog in $dogs) { $msg = $dog.ReportChange() if ($msg) { + $change = $true if ($notify) { $null = [System.Windows.MessageBox]::Show($msg) } Write-Host "$msg" } } + # Update date and time so user knows script hasn't frozen + if (-not ($change)) { + $date = Get-Date -Format "[MM/dd/yy HH:mm:ss]" + Write-Host -NoNewline "$date `r" + } Start-Sleep $sleepTime } }