Announcement

Collapse
No announcement yet.

vbs: enum Printer drivers

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • vbs: enum Printer drivers

    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)
    Marcel
    Technical Consultant
    Netherlands
    http://www.phetios.com
    http://blog.nessus.nl

    MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
    "No matter how secure, there is always the human factor."

    "Enjoy life today, tomorrow may never come."
    "If you're going through hell, keep going. ~Winston Churchill"


  • #2
    kick....


    nobody got a clue? i really need it badly!
    Marcel
    Technical Consultant
    Netherlands
    http://www.phetios.com
    http://blog.nessus.nl

    MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
    "No matter how secure, there is always the human factor."

    "Enjoy life today, tomorrow may never come."
    "If you're going through hell, keep going. ~Winston Churchill"

    Comment


    • #3
      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
      Guy Teverovsky
      "Smith & Wesson - the original point and click interface"

      Comment


      • #4
        yeah,

        or this:

        Code:
        strComputer = "."
        Set objWMIService = GetObject("winmgmts:"& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
        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.
        Marcel
        Technical Consultant
        Netherlands
        http://www.phetios.com
        http://blog.nessus.nl

        MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
        "No matter how secure, there is always the human factor."

        "Enjoy life today, tomorrow may never come."
        "If you're going through hell, keep going. ~Winston Churchill"

        Comment


        • #5
          Originally posted by Antid0t
          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?
          Marcel
          Technical Consultant
          Netherlands
          http://www.phetios.com
          http://blog.nessus.nl

          MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
          "No matter how secure, there is always the human factor."

          "Enjoy life today, tomorrow may never come."
          "If you're going through hell, keep going. ~Winston Churchill"

          Comment

          Working...
          X