Announcement

Collapse
No announcement yet.

Anyway to get EnumPrinterConnections to show full unc

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

  • Anyway to get EnumPrinterConnections to show full unc

    Here is my code so far:

    Code:
    Set WshNetwork = WScript.CreateObject("WScript.Network") 
    Set oPrinters = WshNetwork.EnumPrinterConnections 
    
    
        For i = 0 to oPrinters.Count -1 
             WScript.Echo oPrinters.Item(i) 
        Next
    I want it to show me \\server\printershamename but what i get is \\server\printer name (e.g. \\strefi\E102 HP LaserJet 4200 Series PCL (Draft)) - when i want \\strefi\e102-hp4050tn

    Cheers
    Server 2000 MCP
    Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

    ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

  • #2
    what's the sharename of the printer you see...
    so you connect to the \\server and which printers you'll see?
    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
      They show up as \\server\printersharename i think (on a course at the moment so don't know for sure).
      Server 2000 MCP
      Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

      ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

      Comment


      • #4
        from the WMI wizard in primalscript:
        have a look at the following script:

        Code:
        On Error Resume Next
        Dim strComputer
        Dim objWMIService
        Dim colItems
        
        strComputer = "."
        Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
        Set colItems = objWMIService.ExecQuery("Select * from Win32_Printer",,48)
        For Each objItem in colItems
        	WScript.Echo "Attributes: " & objItem.Attributes
        	WScript.Echo "Availability: " & objItem.Availability
        	WScript.Echo "AvailableJobSheets: " & objItem.AvailableJobSheets
        	WScript.Echo "AveragePagesPerMinute: " & objItem.AveragePagesPerMinute
        	WScript.Echo "Capabilities: " & objItem.Capabilities
        	WScript.Echo "CapabilityDescriptions: " & objItem.CapabilityDescriptions
        	WScript.Echo "Caption: " & objItem.Caption
        	WScript.Echo "CharSetsSupported: " & objItem.CharSetsSupported
        	WScript.Echo "Comment: " & objItem.Comment
        	WScript.Echo "ConfigManagerErrorCode: " & objItem.ConfigManagerErrorCode
        	WScript.Echo "ConfigManagerUserConfig: " & objItem.ConfigManagerUserConfig
        	WScript.Echo "CreationClassName: " & objItem.CreationClassName
        	WScript.Echo "CurrentCapabilities: " & objItem.CurrentCapabilities
        	WScript.Echo "CurrentCharSet: " & objItem.CurrentCharSet
        	WScript.Echo "CurrentLanguage: " & objItem.CurrentLanguage
        	WScript.Echo "CurrentMimeType: " & objItem.CurrentMimeType
        	WScript.Echo "CurrentNaturalLanguage: " & objItem.CurrentNaturalLanguage
        	WScript.Echo "CurrentPaperType: " & objItem.CurrentPaperType
        	WScript.Echo "Default: " & objItem.Default
        	WScript.Echo "DefaultCapabilities: " & objItem.DefaultCapabilities
        	WScript.Echo "DefaultCopies: " & objItem.DefaultCopies
        	WScript.Echo "DefaultLanguage: " & objItem.DefaultLanguage
        	WScript.Echo "DefaultMimeType: " & objItem.DefaultMimeType
        	WScript.Echo "DefaultNumberUp: " & objItem.DefaultNumberUp
        	WScript.Echo "DefaultPaperType: " & objItem.DefaultPaperType
        	WScript.Echo "DefaultPriority: " & objItem.DefaultPriority
        	WScript.Echo "Description: " & objItem.Description
        	WScript.Echo "DetectedErrorState: " & objItem.DetectedErrorState
        	WScript.Echo "DeviceID: " & objItem.DeviceID
        	WScript.Echo "Direct: " & objItem.Direct
        	WScript.Echo "DoCompleteFirst: " & objItem.DoCompleteFirst
        	WScript.Echo "DriverName: " & objItem.DriverName
        	WScript.Echo "EnableBIDI: " & objItem.EnableBIDI
        	WScript.Echo "EnableDevQueryPrint: " & objItem.EnableDevQueryPrint
        	WScript.Echo "ErrorCleared: " & objItem.ErrorCleared
        	WScript.Echo "ErrorDescription: " & objItem.ErrorDescription
        	WScript.Echo "ErrorInformation: " & objItem.ErrorInformation
        	WScript.Echo "ExtendedDetectedErrorState: " & objItem.ExtendedDetectedErrorState
        	WScript.Echo "ExtendedPrinterStatus: " & objItem.ExtendedPrinterStatus
        	WScript.Echo "Hidden: " & objItem.Hidden
        	WScript.Echo "HorizontalResolution: " & objItem.HorizontalResolution
        	WScript.Echo "InstallDate: " & objItem.InstallDate
        	WScript.Echo "JobCountSinceLastReset: " & objItem.JobCountSinceLastReset
        	WScript.Echo "KeepPrintedJobs: " & objItem.KeepPrintedJobs
        	WScript.Echo "LanguagesSupported: " & objItem.LanguagesSupported
        	WScript.Echo "LastErrorCode: " & objItem.LastErrorCode
        	WScript.Echo "Local: " & objItem.Local
        	WScript.Echo "Location: " & objItem.Location
        	WScript.Echo "MarkingTechnology: " & objItem.MarkingTechnology
        	WScript.Echo "MaxCopies: " & objItem.MaxCopies
        	WScript.Echo "MaxNumberUp: " & objItem.MaxNumberUp
        	WScript.Echo "MaxSizeSupported: " & objItem.MaxSizeSupported
        	WScript.Echo "MimeTypesSupported: " & objItem.MimeTypesSupported
        	WScript.Echo "Name: " & objItem.Name
        	WScript.Echo "NaturalLanguagesSupported: " & objItem.NaturalLanguagesSupported
        	WScript.Echo "Network: " & objItem.Network
        	WScript.Echo "PaperSizesSupported: " & objItem.PaperSizesSupported
        	WScript.Echo "PaperTypesAvailable: " & objItem.PaperTypesAvailable
        	WScript.Echo "Parameters: " & objItem.Parameters
        	WScript.Echo "PNPDeviceID: " & objItem.PNPDeviceID
        	WScript.Echo "PortName: " & objItem.PortName
        	WScript.Echo "PowerManagementCapabilities: " & objItem.PowerManagementCapabilities
        	WScript.Echo "PowerManagementSupported: " & objItem.PowerManagementSupported
        	WScript.Echo "PrinterPaperNames: " & objItem.PrinterPaperNames
        	WScript.Echo "PrinterState: " & objItem.PrinterState
        	WScript.Echo "PrinterStatus: " & objItem.PrinterStatus
        	WScript.Echo "PrintJobDataType: " & objItem.PrintJobDataType
        	WScript.Echo "PrintProcessor: " & objItem.PrintProcessor
        	WScript.Echo "Priority: " & objItem.Priority
        	WScript.Echo "Published: " & objItem.Published
        	WScript.Echo "Queued: " & objItem.Queued
        	WScript.Echo "RawOnly: " & objItem.RawOnly
        	WScript.Echo "SeparatorFile: " & objItem.SeparatorFile
        	WScript.Echo "ServerName: " & objItem.ServerName
        	WScript.Echo "Shared: " & objItem.Shared
        	WScript.Echo "ShareName: " & objItem.ShareName
        	WScript.Echo "SpoolEnabled: " & objItem.SpoolEnabled
        	WScript.Echo "StartTime: " & objItem.StartTime
        	WScript.Echo "Status: " & objItem.Status
        	WScript.Echo "StatusInfo: " & objItem.StatusInfo
        	WScript.Echo "SystemCreationClassName: " & objItem.SystemCreationClassName
        	WScript.Echo "SystemName: " & objItem.SystemName
        	WScript.Echo "TimeOfLastReset: " & objItem.TimeOfLastReset
        	WScript.Echo "UntilTime: " & objItem.UntilTime
        	WScript.Echo "VerticalResolution: " & objItem.VerticalResolution
        	WScript.Echo "WorkOffline: " & objItem.WorkOffline
        Next
        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
          Code:
          WScript.Echo "ShareName: " & objItem.ShareName
          This one looks like the badger! (Or 'looks like the one' for those who aren't familar with UK slang)
          Server 2000 MCP
          Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

          ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

          Comment


          • #6
            good luck with it
            oh which editor do you use?
            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


            • #7
              For scripting? Good old notepad!
              Server 2000 MCP
              Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

              ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

              Comment


              • #8
                well have a look at this then..
                it isn't very expensive, and i really love the colors...
                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


                • #9
                  $179!! I think ill stick to notepad!
                  Server 2000 MCP
                  Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

                  ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

                  Comment

                  Working...
                  X