diff --git a/HP_printer_555/hp_smart_tank_plus_555_head_clean.ps1 b/HP_printer_555/hp_smart_tank_plus_555_head_clean.ps1 index 337be94..c5b48e2 100644 --- a/HP_printer_555/hp_smart_tank_plus_555_head_clean.ps1 +++ b/HP_printer_555/hp_smart_tank_plus_555_head_clean.ps1 @@ -62,6 +62,7 @@ $actual_time = get-date # check if hour of running isnt restricted by $running_time_start and $running_time_stop if (($actual_time.hour -lt $running_time_start) -and ($actual_time.hour -gt $running_time_stop)) { $logs += log -l_level 0 -l_message "Hours between $running_time_start and $running_time_stop are restricted. EXIT" + $logs += log -l_level 0 -l_message "Script Stopped" log_store exit } @@ -88,6 +89,7 @@ try { $actual_p_count = (snmpget -v $snmp_ver -c $snmp_community $printer_ip $snmp_code).Split(" ")[-1] } catch { $logs += log -l_level 2 -l_message "Getting printed page count got ERROR. EXIT" + $logs += log -l_level 0 -l_message "Script Stopped" log_store exit } @@ -97,6 +99,7 @@ if ($actual_p_count -gt $last_run.p_count) { $last_run.p_count = $actual_p_count $last_run.date = $actual_time $last_run | Export-Csv -Path $path_last_run -NoTypeInformation + $logs += log -l_level 0 -l_message "Script Stopped" log_store exit } @@ -114,6 +117,7 @@ if ($difference -gt $days_between) { $last_run.date = $actual_time } catch { $logs += log -l_level 2 -l_message "Error durring connecting to printer." + $logs += log -l_level 0 -l_message "Script Stopped" log_store exit } @@ -128,5 +132,6 @@ $last_run.p_count = $actual_p_count $last_run | Export-Csv -Path $path_last_run -NoTypeInformation $logs += log -l_level 0 -l_message "Head Cleaning Stopped. Actual date: $actual_time. Actuall printed page count: $actual_p_count." +$logs += log -l_level 0 -l_message "Script Stopped" log_store -exit \ No newline at end of file +exit