modified: HP_printer_555/hp_smart_tank_plus_555_head_clean.ps1

Corrected restricted hours section.
This commit is contained in:
Tomasz Kostrzewa 2023-12-28 16:18:17 +01:00
parent f40fdbfa4c
commit 1a99d1788e

View File

@ -5,8 +5,8 @@
# requere installed snmp
# set time when printer can run head cleanning
$running_time_start = 8
$running_time_stop = 22
$running_time_start = 10
$running_time_stop = 20
# set day interval between last print and head cleannig
$days_between = 7
@ -18,7 +18,7 @@ $path_last_run = "$($location)/hp_clean_last_run"
$path_log = "$($location)/hp_clean_log"
$snmp_ver = "2c"
$snmp_community = "public"
$snmp_code = "iso.3.6.1.2.1.43.10.2.1.4.1.1" # OID for printed pages
$snmp_code = "iso.3.6.1.2.1.43.10.2.1.4.1.1" # OID for printed pages durring actuall sesion
$printer_ip = "" # printer IP
$url = "http://$($printer_ip)/DevMgmt/InternalPrintDyn.xml" # url where we need to POST body for start HEAD cleaning.
$body = "<ipdyn:InternalPrintDyn xmlns:ipdyn=`"http://www.hp.com/schemas/imaging/con/ledm/internalprintdyn/2008/03/21`" xmlns:copy=`"http://www.hp.com/schemas/imaging/con/copy/2008/07/07`" xmlns:dd=`"http://www.hp.com/schemas/imaging/con/dictionaries/1.0/`" xmlns:dd3=`"http://www.hp.com/schemas/imaging/con/dictionaries/2009/04/06`" xmlns:fw=`"http://www.hp.com/schemas/imaging/con/firewall/2011/01/05`"><ipdyn:JobType>cleaningVerificationPage</ipdyn:JobType></ipdyn:InternalPrintDyn>"
@ -56,7 +56,8 @@ function log_store {
}
}
$logs += log -l_level 0 -l_message "Script Started"
$actual_time = get-date -Format "yyyy-MM-dd HH:mm:ss.ffff"
$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)) {
@ -65,6 +66,8 @@ if (($actual_time.hour -lt $running_time_start) -and ($actual_time.hour -gt $run
exit
}
$actual_time = get-date -Format "yyyy-MM-dd HH:mm:ss.ffff"
# check / create last run control file
if (-not(Test-Path $path_last_run)) {
$logs += log -l_level 1 -l_message "$($path_last_run) Does not exists - CREATING."
@ -120,6 +123,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 "Head Cleaning Stopped. Actual date: $actual_time. Actuall printed page count: $actual_p_count."
log_store
exit