Printers report ??

This topic contains 10 replies, has 5 voices, and was last updated by Avatar gforceindustries 9 years, 9 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • Avatar
    tulik23
    Member
    #149665

    Hi

    i need to export from the print server all the details i can from the printers
    printer name , IP , location ….

    any VB or application will be good

    i have found this vb , but it fails on line 30 char 1

    please assist

    http://community.spiceworks.com/scripts/show/356-list-printers-vbs

    Avatar
    tulik23
    Member
    #286306

    Re: Printers report ??

    Hi

    is it so hard to find ?

    i thought its much easier :(

    thanks

    Avatar
    Ossian
    Moderator
    #181708

    Re: Printers report ??

    Wow!
    No reply in 1 hour 17 minutes, on a Sunday
    Lousy quality of service these days :evil:. There goes my bonus this month :twisted:

    With nearly 4 years membership you SHOULD know how the board works — you will get an answer IF someone has one and WHEN they have the free time to post it.

    If you really DO need support on this timescale, raise an incident with Microsoft PSS. Have your credit card ready.

    Oh, just a tiny hint as to the OS on your server would possibly help, or shall I just assume it is NT3.51?

    Avatar
    tulik23
    Member
    #286307

    Re: Printers report ??

    Hi

    this wasnt from critisize :)
    just wandering

    my OS is server 2003

    10x

    #344231

    Re: Printers report ??

    Is this for purposes of documentation (if you have too many printers to do this manually, then it seems you’re leaving the documenting of your setup a little late ;)) or for backup/migration?

    If it’s for backup or migration, then would Microsoft Print Migrator or the Printer Migration Wizard meet your requirements? Amazing what you can find with 30 seconds of Googling.

    Avatar
    Ossian
    Moderator
    #181709

    Re: Printers report ??

    OK, tried it and got multiple errors.
    This does work, though:

    ‘==========================================================================’
    ‘ Title: List Printers.vbs’
    ‘ Date: 02/23/2010’
    ‘ Author: Bradley Buskey’
    ‘ Version: 1.00’
    ‘ Updated: 02/23/2010’
    ‘ Purpose: List all printers attached to a workstation’
    ‘Modified T Jones 20/6/10
    ‘==========================================================================’
    ‘==========================================================================’
    ‘ Date 03/29/2010
    ‘ updated: Chris Daws
    ‘ to include mapped network printers
    ‘==========================================================================
    Const ForAppending = 8
    Const ForReading = 1

    Dim WshNetwork, objPrinter, intDrive, intNetLetter, UserName

    strComputer = inputbox(“Please enter the computer name or IP address.”,”Computer Name”,”.”)

    Set WshNetwork = CreateObject(“WScript.Network”)
    Set objWMIService = GetObject(“winmgmts:{impersonationLevel=impersonate}!\” & strComputer & “rootcimv2”)
    Set colInstalledPrinters = objWMIService.ExecQuery(“Select * from Win32_Printer”)
    Set colItems = objWMIService.ExecQuery(“Select * from Win32_ComputerSystem”,,48)
    Set WshShell = WScript.CreateObject(“WScript.Shell”)
    Set objFSO = CreateObject(“Scripting.FileSystemObject”)

    For Each objItem in colItems
    UserName = objItem.Name’ wasUserName

    ‘arrUserName = Split(UserName, “”, -1, 1)
    varUserName = UserName’arrUserName(1)
    Next

    filOutput = varUserName & “.txt”

    If objFSO.FileExists(filOutput) Then
    objFSO.DeleteFile(filOutput)
    End If

    Set objOutputFile = objFSO.OpenTextFile (filOutput, ForAppending, True)
    For Each objPrinter in colInstalledPrinters
    strTest = Left(objPrinter.Name, 2)
    objOutputFile.WriteLine(objPrinter.Name)
    Next
    ‘objOutputFile.Close

    ‘added
    Set objPrinter = WshNetwork.EnumPrinterConnections
    ‘Set objOutputFile = objFSO.OpenTextFile (filOutput, ForAppending, True)
    If objPrinter.Count = 0 Then
    WScript.Echo “No Printers Mapped ”
    else
    For intDrive = 0 To (objPrinter.Count -1) Step 2
    intNetLetter = IntNetLetter +1
    printer = “UNC Path ” & objPrinter.Item(intDrive) & ” = ” & objPrinter.Item(intDrive +1) & ” Printer : ” & intDrive
    objOutputFile.WriteLine(printer)
    Next
    end if
    objOutputFile.Close
    ‘added

    varOpen = MsgBox(“Do you want to view the printers?”,36,”View File?”)
    If varOpen = vbYes Then
    varCommand = “notepad ” & filOutput
    WshShell.Run varCommand,1,False
    End If

    Wscript.Sleep 1500
    MsgBox “Printer mappings have been stored in ‘” & filOutput & “‘.”, 64, “Script Complete”
    Wscript.Quit
    [/CODE][CODE]
    ‘==========================================================================’
    ‘ Title: List Printers.vbs’
    ‘ Date: 02/23/2010’
    ‘ Author: Bradley Buskey’
    ‘ Version: 1.00’
    ‘ Updated: 02/23/2010’
    ‘ Purpose: List all printers attached to a workstation’
    ‘Modified T Jones 20/6/10
    ‘==========================================================================’
    ‘==========================================================================’
    ‘ Date 03/29/2010
    ‘ updated: Chris Daws
    ‘ to include mapped network printers
    ‘==========================================================================
    Const ForAppending = 8
    Const ForReading = 1

    Dim WshNetwork, objPrinter, intDrive, intNetLetter, UserName

    strComputer = inputbox(“Please enter the computer name or IP address.”,”Computer Name”,”.”)

    Set WshNetwork = CreateObject(“WScript.Network”)
    Set objWMIService = GetObject(“winmgmts:{impersonationLevel=impersonate}!\” & strComputer & “rootcimv2”)
    Set colInstalledPrinters = objWMIService.ExecQuery(“Select * from Win32_Printer”)
    Set colItems = objWMIService.ExecQuery(“Select * from Win32_ComputerSystem”,,48)
    Set WshShell = WScript.CreateObject(“WScript.Shell”)
    Set objFSO = CreateObject(“Scripting.FileSystemObject”)

    For Each objItem in colItems
    UserName = objItem.Name’ wasUserName

    ‘arrUserName = Split(UserName, “”, -1, 1)
    varUserName = UserName’arrUserName(1)
    Next

    filOutput = varUserName & “.txt”

    If objFSO.FileExists(filOutput) Then
    objFSO.DeleteFile(filOutput)
    End If

    Set objOutputFile = objFSO.OpenTextFile (filOutput, ForAppending, True)
    For Each objPrinter in colInstalledPrinters
    strTest = Left(objPrinter.Name, 2)
    objOutputFile.WriteLine(objPrinter.Name)
    Next
    ‘objOutputFile.Close

    ‘added
    Set objPrinter = WshNetwork.EnumPrinterConnections
    ‘Set objOutputFile = objFSO.OpenTextFile (filOutput, ForAppending, True)
    If objPrinter.Count = 0 Then
    WScript.Echo “No Printers Mapped “
    else
    For intDrive = 0 To (objPrinter.Count -1) Step 2
    intNetLetter = IntNetLetter +1
    printer = “UNC Path ” & objPrinter.Item(intDrive) & ” = ” & objPrinter.Item(intDrive +1) & ” Printer : ” & intDrive
    objOutputFile.WriteLine(printer)
    Next
    end if
    objOutputFile.Close
    ‘added

    varOpen = MsgBox(“Do you want to view the printers?”,36,”View File?”)
    If varOpen = vbYes Then
    varCommand = “notepad ” & filOutput
    WshShell.Run varCommand,1,False
    End If

    Wscript.Sleep 1500
    MsgBox “Printer mappings have been stored in ‘” & filOutput & “‘.”, 64, “Script Complete”
    Wscript.Quit
    [/CODE]

    Avatar
    L4ndy
    Member
    #276812

    Re: Printers report ??

    Ossian;208495 wrote:
    Lousy quality of service these days :evil:. There goes my bonus this month :twisted:

    I thought you lost your bonus last month when you didn’t reply to a thread all night long :-D

    Anyways, for 2003 and prior os, you could also use Print migrator 3.1.
    There are a few things worth mentioning though, it is no longer supported by MS, it has a few restrictions but in general it works fine.

    Avatar
    tulik23
    Member
    #286308

    Re: Printers report ??

    11112131313132

    the script worked 50%

    only printer name no ip

    error on line
    75
    char 1

    Avatar
    Wired
    Moderator
    #273644

    Re: Printers report ??

    What does 11112131313132 mean???

    That error is the last line of the script. Delete the line or ignore the error.

    Avatar
    tulik23
    Member
    #286309

    Re: Printers report ??

    it should bring me also the ip of the printer , right ?

    the number are keyboard problem :(

    Avatar
    Ossian
    Moderator
    #181722

    Re: Printers report ??

    I dont think it is designed to list the IP — it asks for a name or IP to find the computer to run on, but doesnt list an IP as part of the output

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

You must be logged in to reply to this topic.