Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Using script to monitor the application of toner in printer

Shulou Source: shulou.com Published: 2022-06-01 06:57:43 10月04日 Update

We use the content introduced in the previous document to write a monitoring printer application:

The script reads as follows:

$Printers= "172.28.10.201", "172.28.10.202"

Foreach ($printer in $Printers) {

$emailbody= "

Printer address to be maintained:

Http://$printer/SSI/index.htm

Please refer to the following comparison table:

172.28.10.201, (16F print area (Mobile Division))

172.28.10.202, (16F copy area)

$url=invoke-webrequest "http://$printer/SSI/index.htm"

$cartridge= ($url.ALLelements.innertext | findstr "%") [1]

$stringnumber= (($cartridge.replace ("", "). Replace ("% ","). Replace ("Black Cartridge", "). Replace (" * ",")

Echo $stringnumber

$intnumber= [int] $stringnumber

If ($intnumber-le 5) {

Echo $printer

Send-MailMessage-From it@contoso.com-To lixs@contoso.com-SmtpServer mail.contoso.com-Subject "Printer toner less than 5% Please change in time"-body "$emailbody"-Encoding ([System.Text.Encoding]:: UTF8)

}

}

Screenshot of email alarm

Tags: Printer content toner script monitoring first article career business department address comparison table screenshot document email photocopying application alarm mobile status Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information vpn Huawei Docker OPPO Reno