Microsoft Windows Scripting Self-Paced learning Guide

Source: Internet
Author: User

Http://www.mums.ac.ir/shares/hit/eduhit/book/windowsscripting.pdf
Http://support.microsoft.com/kb/926352/en-us
https://www.microsoft.com/learning/en-us/book.aspx?id=6789
Filterprinterstatus.vbs

Option Explicit ' on Error Resume nextdim strcomputerdim wminsdim wmiquerydim objwmiservicedim colitemsdim Objitemdim strSt Atusstrcomputer = "." Wmins = "\root\cimv2" wmiquery = "SELECT * from Win32_Printer" _& "Where printerstatus = 1" _& "or Printerstatus  = 2 "_&" or Printerstatus = 7 "Set objWMIService = GetObject (" winmgmts:\\ "_& StrComputer & wmins) Set colitems = objWMIService.ExecQuery (wmiquery) If colitems.count = 0 Thenwscript.echo "All printers is fine" elsefor each objitem in Colitemswscript.echo "Name:" & ObjItem.NameWScript.Echo "Location:" & ObjItem.LocationsubEvalStatusWScript.Echo "Printer Status:" & Strstatuswscript.echo "Server Name:" & ObjItem.ServerNameWScript.Echo "Share Name:" & objItem.ShareNameWScript.EchoNextEnd ifsub Subevalstatusselect Case Objitem.printerstatuscase 1strStatus = ' other ' case 2strStatus = ' Unknown ' case 3strStatus = ' Idle ' case 4strStatus = "P Rinting "Case 5strStatus =" warmup "Case 6strStatus =" Stopped PriNting "Case 7strStatus =" Offline "End selectend Sub 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.