vbs: enum Printer drivers

Home Forums Scripting Windows Script Host vbs: enum Printer drivers

This topic contains 4 replies, has 2 voices, and was last updated by Avatar Dumber 15 years, 5 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • Avatar
    Dumber
    Participant
    #98751

    Gentleman (and ladies?)

    i wrote the following script to enum the print drivers:

    Code:
    dim objMaster, objDriver
    set objMaster = CreateObject(”PrintMaster.PrintMaster.1″)
    for each objDriver in objMaster.Drivers(”\server”)
    wscript.echo “DriverName : ” & objDriver.ModelName
    wscript.echo “Version : ” & objDriver.Version
    wscript.echo “DriverVersion : ” & objDriver.DriverVersion
    wscript.echo “DriverPath : ” & objDriver.Path
    wscript.echo “Environment : ” & objDriver.Environment
    wscript.echo “DriverEnv : ” & objDriver.DriverArchitecture
    wscript.echo “MonitorName : ” & objDriver.MonitorName
    next

    its a great script to enum the printerdrivers on a remote machine, but now i want to modify this script to use this for a local computer, but that doesn’t work.

    i only replaced the \server for a . (dot)

    the following error is what i got:
    the parameter is incorrect.

    when i replaced the \server for \computername is the following error i got:

    The environment specified is invalid.
    even when i used the FQDN

    thnx for the support!
    anyone got a clue what or why this happens here?

    edit: im using the prnadmin.dll from the windows 2000 resource kit (xp client)

    Avatar
    Dumber
    Participant
    #194325

    kick….

    nobody got a clue? i really need it badly!

    Avatar
    guyt
    Member
    #192364

    Dirty workaround:

    Code:
    Set objAdsSystemInfo = CreateObject(”adsysteminfo”)
    Set objComputerName = Getobject(”LDAP://” & objAdsSystemInfo.ComputerName)
    strHostName = UCase(replace(objComputerName.Name,”CN=”,””))
    dim objMaster, objDriver
    set objMaster = CreateObject(”PrintMaster.PrintMaster.1″)
    for each objDriver in objMaster.Drivers(”\” & strHostName)
    wscript.echo “DriverName : ” & objDriver.ModelName
    [snip]
    next
    Avatar
    Dumber
    Participant
    #194326

    yeah,

    or this:

    Code:
    strComputer = “.”
    Set objWMIService = GetObject(”winmgmts:”& “{impersonationLevel=impersonate}!\” & strComputer & “rootcimv2″)
    Set colInstalledPrinters = objWMIService.ExecQuery (”Select * from Win32_PrinterDriver”)
    For each objPrinter in colInstalledPrinters
    Wscript.Echo “Name: ” & objPrinter.Name
    Wscript.Echo “Config File: ” & objPrinter.ConfigFile
    Wscript.Echo “Data File: ” & objPrinter.DataFile
    Wscript.Echo “Description: ” & objPrinter.Description
    Wscript.Echo “Driver Path: ” & objPrinter.DriverPath
    Wscript.Echo “File Path: ” & objPrinter.FilePath
    Wscript.Echo “Help File: ” & objPrinter.HelpFile
    Wscript.Echo “INF Name: ” & objPrinter.InfName
    Wscript.Echo “Monitor Name: ” & objPrinter.MonitorName
    Wscript.Echo “OEMUrl: ” & objPrinter.OEMUrl
    Wscript.Echo “Supported Platform: ” & objPrinter.SupportedPlatform
    Wscript.Echo “Version: ” & objPrinter.Version

    thnx anyway antid0t.

    Avatar
    Dumber
    Participant
    #194327
    Antid0t wrote:
    Dirty workaround:

    Code:
    Set objAdsSystemInfo = CreateObject(”adsysteminfo”)
    Set objComputerName = Getobject(”LDAP://” & objAdsSystemInfo.ComputerName)
    strHostName = UCase(replace(objComputerName.Name,”CN=”,””))
    dim objMaster, objDriver
    set objMaster = CreateObject(”PrintMaster.PrintMaster.1″)
    for each objDriver in objMaster.Drivers(”\” & strHostName)
    wscript.echo “DriverName : ” & objDriver.ModelName
    [snip]
    next

    i got the following error:
    the data area passed to a system call is to small
    any idea what this means?

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.