উইন্ডোজে অব্যবহৃত প্রিন্টারগুলি কীভাবে খুঁজে পাবেন (বা শেষ বার কোনও প্রিন্টার ব্যবহার করা হয়েছিল)?


2

আমরা উইন্ডোতে অব্যবহৃত প্রিন্টারগুলি খুঁজে পাওয়ার জন্য একটি উপায় খুঁজছি (উইন্ডোজ 7 / সার্ভার ২০০৮ এবং তারপরে)।

আমরা এই ভিবিএস স্ক্রিপ্টটি পরীক্ষা করেছিলাম কীভাবে: সমস্ত অব্যবহৃত প্রিন্টার ড্রাইভারের তালিকাবদ্ধ করুন এবং যদিও সিস্টেমে অব্যবহৃত প্রিন্টার রয়েছে, কোনও ফলাফল পাওয়া যায় নি।

'================================
'
' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 3.0
'
' NAME: Unused_Printer_Drivers.vbs
'
' AUTHOR: Robert Murray
' DATE  : 20/10/2008
' SEE: http://robertomurray.co.uk/blog/2008/how-to-list-all-unused-printer-drivers-on-a-print-server-using-vbscript/
'
' COMMENT: Script to gather current attached printers, printer drivers
'           installed and list the unused drivers.
'
'========================================
On Error Resume Next


'def vars
Dim objDictionary, strComputer, counter, myfilename, forReading, forWriting, IEProg, total, _
    PrtDrvName, pos, thisComp

'computer on which to run check - "." is local machine
strComputer = "."

'Path and file in which to save report
myfilename = "tempprtDrvrs.html"

IEProg = "iexplore.exe"
counter = 0
forReading = 1: forWriting = 2: ynCreate = 1

'=========================================
'Set objects
'=========================================

'WMI connection
Set objWMIService = GetObject("winmgmts:\" & strComputer & "rootCIMV2") 

'WMI queries
Set colPrinterItems = objWMIService.ExecQuery( _
    "SELECT * FROM Win32_Printer")
Set colPrinterDrivers =  objWMIService.ExecQuery _
    ("Select * from Win32_PrinterDriver")

'to get computer name
Set objNetwork = CreateObject("WScript.Network")

thisComp = objNetwork.ComputerName

'scripting Dictionary -> database
Set objDictionary = CreateObject("Scripting.Dictionary")

'FSO & Shell
set fso = CreateObject("Scripting.FileSystemObject")
set objShell = CreateObject("Wscript.Shell") 

'open file for writing
set myTextStream = fso.OpenTextFile(myfilename,forWriting,ynCreate)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

'=================================================
'Do the hard work
'=================================================


'Add all printer drivers used by attached PRINTERS to database
    For Each objItem in colPrinterItems 

        objDictionary.Add objItem.DriverName, objItem.DriverName

        'not used.
        '"DriverName: " & objItem.DriverName
        '"Name: " & objItem.Name
        '" & objItem.PortName    
        'counter = counter + 1

    Next


    'write header & build table for report
    myTextStream.Write "<h1>Unused Printer Drivers</h1>"

    myTextStream.Write "<h5>Date: " & Now & "</h5>" & vbcrlf
    myTextStream.Write "<h5>Computer Name: " & thisComp & "</h5>" & vbcrlf

    myTextStream.Write "" & vbcrlf

    myTextStream.Write "" & vbcrlf

    myTextStream.Write "" & vbcrlf
    myTextStream.Write "" & vbcrlf
    myTextStream.Write "" & vbcrlf
    myTextStream.Write "" & vbcrlf

    myTextStream.Write "" & vbcrlf

    'reset counter - if used previously
    counter = 0


    'loop through all DRIVERS and if NOT in database then driver is NOT used so output this driver
    For Each objPrDrvrItem in colPrinterDrivers

        'get rid of the junk on the end of returned value
        pos=InStr(objPrDrvrItem.Name,",") -1
        PrtDrvName = Left(objPrDrvrItem.Name,pos)

        'check if in database
        if objDictionary.Exists(PrtDrvName) then

            ' Do nothing -> driver is in use.

        Else

            'Output printer driver name, platform and version of all not in use ie not in the database
            myTextStream.Write "" & vbcrlf
            myTextStream.Write "" & vbcrlf
            myTextStream.Write "" & vbcrlf
            myTextStream.Write "" & vbcrlf
            myTextStream.Write "" & vbcrlf
            myTextStream.Write "" & vbcrlf

            'increment counter
            counter = counter + 1

        end if


    Next

'write number of unused drivers on bottom row
myTextStream.Write "" & vbcrlf
myTextStream.Write "" & vbcrlf
myTextStream.Write "" & vbcrlf

'end table

myTextStream.Write "<table border=""1"" cellspacing=""2"" cellpadding=""3""><tbody><tr><th>Status</th><th>Driver Name</th><th>Platform</th><th>OS (3 is 2000 and above)</th></tr><tr><td>Driver not used.</td><td>" & PrtDrvName & "</td><td>" & objPrDrvrItem.SupportedPlatform & "</td><td>" & objPrDrvrItem.Version & "</td></tr><tr><td colspan="" 4""="">There are " & objDictionary.Count & " drivers USED and " & _
                            counter & " drivers UNUSED installed currently.</td></tr></tbody></table>" & vbcrlf


'close file
myTextStream.Close


'Finally - open file with IE
objShell.Run (IEProg & " " & myfilename)


'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' END
'=====================================================

আমরা একটি আছে Windows 2008 R2 Terminalserver। এ printer queuessecond Windows 2008 R2 Server

শেষবার যখন কোনও প্রিন্টার ব্যবহার করা হয়েছিল তখন সময় পাওয়ার কী উপায় আছে?

আমাদের সাইট ব্যবহার করে, আপনি স্বীকার করেছেন যে আপনি আমাদের কুকি নীতি এবং গোপনীয়তা নীতিটি পড়েছেন এবং বুঝতে পেরেছেন ।
Licensed under cc by-sa 3.0 with attribution required.