Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Using script to monitor the application of toner in printer

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report