locked
add printer on remote computer RRS feed

  • Question

  • In my environment I need to add printers on remote computers. I can’t use active directory. My account has admin privileges, but the remote computer is setup to auto login to an account and that account is just a member of the domain users group. So far I pieced this script together, but it needs to be run on the remote computer

    Dim printer, UNCpath1, slash1, slash2

    slash2 = "\\"

    slash1 = "\"

    printername = InputBox("What printer do you want to be the default? ", "Create Default Printer")

    UNCpath1 = InputBox("What server is this printer on? ", "Server")

    Set printer = CreateObject("WScript.Network")

    printer.AddWindowsPrinterConnection slash2 & UNCpath1 & slash1 & printername

    printer.SetDefaultPrinter slash2 & UNCpath1 & slash1 & printername

    WScript.Quit

    I would like a script that has input boxes to ask what printer you want to setup, and which print server the printer is on.

    Please phrase your answer with the knowledge that I know next to NOTHING about scripting. The script above was pieced together after a lot of searching.

    Friday, January 31, 2014 10:00 PM

Answers

  • Sorry - can't help you. I recommend you work with your Domain Admins to get permission on the users policy.  In most cases I know of the desktop people are no allowed to alter user profiles.  You can talk a user through a mapping but all remote access to the users is locked down and controlled by policy.  You are trying to circumvent corporate policy so you will likely not succeed.

    Windows was not designed to allow you to do what you want.

    In most of out domains users are required to map their own printers and drives. This is part of the user's training.  It is done to eliminate nuisance calls to the help desk especially in cases where the help desk is metered.

    I would work closely with the Domain Admins to come upi with a resolution or to learn what the company policy is.

    There is no magic way to inject a drive or printer into a users profile.


    ¯\_(ツ)_/¯

    • Marked as answer by Jeffrbeall Tuesday, February 4, 2014 7:53 PM
    Monday, February 3, 2014 10:29 PM

All replies

  • You cannot add printer to a remote user profile.  It is not possible.  Either do it with a logon script or with Group Policy.  Call your domain admon to learn why this is not possible.


    ¯\_(ツ)_/¯

    Friday, January 31, 2014 10:04 PM
  • Ok, Thank you for the reply.

    I am asking this question because the domain admin doesn't have time for me and my questions. So do you have a link to an explanation of why this isn't possible?  I love to learn as much as I can so I can do my job better and better.

    Sunday, February 2, 2014 1:22 AM
  • Just think about it.  A user who is not logged in cannot be mapped and a user logged in you have no access to.\

    I recommend you take the MCP basic course on supporting Windows workstation.  Once you understand the basics you will understand why you cannot do this.

    With WIndows Vista and lateer all things like thisbecome nearly impossible.

    Look up and study user profiles and the user context. YOu must run in the users context (profile loaded) in order to map drive.

    It is possible to inject a machine level printer but you need to alter the registry directly in order to do this.  Tat will make the printer available to everyone who uses the machine.

    We almost always do this with GPP from the domain controller.


    ¯\_(ツ)_/¯

    Sunday, February 2, 2014 2:28 AM
  • so your just talking about users and permissions and privledges.

    I used to support an Active Directory environment and understand that stuff. I thought you meant that there is some reason in scripting that didn't allow this.

    as far as this being impossible due to user accounts, I don't think that is entirely true. For instance, if I have Admin rights, I can access the "hidden" share,  on a remote pc and access the files using \\ machinename \ c$

    Or with psexec, I can remotely do lots of things using my account and accessing a computer that is logged in with a different account.

    also using

    rundll32 printui.dll,PrintUIEntry

    I am able to use psexec and run this command from a dos prompt and add a printer, however, it is a little cumbersome and therefore I thought that maybe there was a better way by using a script.

    Monday, February 3, 2014 2:54 PM
  • You cannot add a printer to the user account without running the "PrintUIEntry" under the user credentials.  By default users do not have remoting capability. Tell me how you think you are going to run this.

    A user printer is mapped to their registry.  You cannot remotely edit a users registry.  I will say this.  It is possible but it I=s a very technically challenging thing to do and risks locking out the user and corrupting the users profile.  I recommend that you only use Group Policy.

    If, as you say, you are able to do what you are asking with PsExec then why ask for a non-existent PowerShell method.  Remember that PsExec installs a special set of components on the remote system.  In many companies this is not allowed.  PsExec can do some things that other scripting environments cannot do.

    Mapping printers and drives requires running in the context of the user.  Standard users cannot remote and you cannot impersonate a user without their password.  Solve these three problems and you can remotely connect a users printers and drives.

    Group Policy runs in the context of the user during the logon.


    ¯\_(ツ)_/¯

    Monday, February 3, 2014 3:26 PM
  •  

    I can't do anything with Group Policy at my new job.

    Where I used to work, I controlled group policy, and then adding it through group policy was a possibility, but now I must work under conditions in which group policy is off limits to me.

    I said that doing this using psexec is cumbersome, so I wanted to see if this is possible through scripting. And the script I pieced together that I show in my first post works fine, as long as I remote into the computer using a program called Proxy Pro Master.

    I want to use something else, because it is hard to coordinate a time to proxy into a user's computer. And the computers I am working with are so locked down, you can't change the default printer for instance. However, with my script, it changes the default.

    I know very little about scripting, and thought that if my pieced together script could change the default printer, maybe a script could add printers remotely. So a user would request a printer, and on my pc, I could run the script to add whatever printer they want.

    Monday, February 3, 2014 9:57 PM
  • Sorry - can't help you. I recommend you work with your Domain Admins to get permission on the users policy.  In most cases I know of the desktop people are no allowed to alter user profiles.  You can talk a user through a mapping but all remote access to the users is locked down and controlled by policy.  You are trying to circumvent corporate policy so you will likely not succeed.

    Windows was not designed to allow you to do what you want.

    In most of out domains users are required to map their own printers and drives. This is part of the user's training.  It is done to eliminate nuisance calls to the help desk especially in cases where the help desk is metered.

    I would work closely with the Domain Admins to come upi with a resolution or to learn what the company policy is.

    There is no magic way to inject a drive or printer into a users profile.


    ¯\_(ツ)_/¯

    • Marked as answer by Jeffrbeall Tuesday, February 4, 2014 7:53 PM
    Monday, February 3, 2014 10:29 PM
  • That's fine.

    The script I pieced together works with the proxy program, so there is a way for me to setup the printers.

    I was thinking maybe there is a better way, but since there isn't, I'll just keep using what I have.

    Thank you for the help.

    Tuesday, February 4, 2014 7:55 PM