Mapping a pritner for a user...

Posted on 2004-10-25
Last Modified: 2010-04-14 would i map a printer for a remote user to a lpt3 port. Windows 2000 enviroment, locally would be net use lpt3: \\server\printer /persistent:yes now how would i do on a remote machine?

Question by:mrochac
    LVL 76

    Accepted Solution

    If you have administrative rights on all the computers, then you can use PSEXEC from Sysinternals (  It allows you to execute commands on remote machines.  And if you need to do this on a number of machines, then you could script the execution - running through a loop of machine names issuing the PSEXEC command for each.
    LVL 1

    Author Comment

    Exacly what i wanted, one more ? do you know how to find out what printers are installed locally?

    LVL 76

    Expert Comment

    by:David Lee
    Yes.  Here's a simple script (VBScript) that uses WMI (Windows Management Instrumentation) to return the details of all the installed printers on the local computer.  If you have adequate rights you can use this script to get the details from a remote computer.  To do that simply change

        strComputer = "."

        strComputer = "SomeComputerName"

    Save the script below into a file ending with .vbs, then run it using CScript.  If you use WScript instead of CScript, then each Wscript.Echo command will create its own dialog-box, which is a real pain.

    On Error Resume Next
    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 "AveragePagesPerMinute: " & objItem.AveragePagesPerMinute
        Wscript.Echo "Capabilities: " & objItem.Capabilities
        Wscript.Echo "CapabilityDescriptions: " & objItem.CapabilityDescriptions
        Wscript.Echo "Caption: " & objItem.Caption
        Wscript.Echo "ConfigManagerErrorCode: " & objItem.ConfigManagerErrorCode
        Wscript.Echo "ConfigManagerUserConfig: " & objItem.ConfigManagerUserConfig
        Wscript.Echo "CreationClassName: " & objItem.CreationClassName
        Wscript.Echo "DefaultPriority: " & objItem.DefaultPriority
        Wscript.Echo "Description: " & objItem.Description
        Wscript.Echo "DetectedErrorState: " & objItem.DetectedErrorState
        Wscript.Echo "DeviceID: " & objItem.DeviceID
        Wscript.Echo "DriverName: " & objItem.DriverName
        Wscript.Echo "ErrorCleared: " & objItem.ErrorCleared
        Wscript.Echo "ErrorDescription: " & objItem.ErrorDescription
        Wscript.Echo "HorizontalResolution: " & objItem.HorizontalResolution
        Wscript.Echo "InstallDate: " & objItem.InstallDate
        Wscript.Echo "JobCountSinceLastReset: " & objItem.JobCountSinceLastReset
        Wscript.Echo "LanguagesSupported: " & objItem.LanguagesSupported
        Wscript.Echo "LastErrorCode: " & objItem.LastErrorCode
        Wscript.Echo "Location: " & objItem.Location
        Wscript.Echo "Name: " & objItem.Name
        Wscript.Echo "PaperSizesSupported: " & objItem.PaperSizesSupported
        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 "SeparatorFile: " & objItem.SeparatorFile
        Wscript.Echo "ServerName: " & objItem.ServerName
        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 ""

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    856 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now