Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 261
  • Last Modified:

copy default printer from remote machine

Hello Experts
I am haven trouble finding a way to copy a default printer from one machine to another. When a user log on to the machine the default printer from a remote machine should be added and set to default printer on the users machine.

Can somebody help me?
0
aslandk
Asked:
aslandk
  • 8
  • 7
1 Solution
 
Julian HansenCommented:
This is a bit of a confusing question. Default printers are assigned in the user profile - when users add printers to their profiles they choose which one will be the default.

Unless the user that you want to copy from is logged into the remote machine you are not going to find what you are looking for on that machine. You will find the default printer information in the user registry. But this could get tricky because you first have to figure out if the user is using local or roaming profiles and then figure out where their profile is stored before opening it and browsing to

<profile>\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device

Once you have the printer name the rest is easy: Use the SetDefaultPrinter API call and bingo.

0
 
aslandkAuthor Commented:
hehe i know the quaetion is a bit confusion....

The user logges on to citrix and need the deafault printer to be mapped to the profile on the citirx server....it is roaming profile.

Is that more clear?:)
0
 
aslandkAuthor Commented:
isent it possible to use the add printer function:

Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\\PrintServer1\Xerox300"
WshNetwork.SetDefaultPrinter "\\PrintServer1\Xerox300"



but make the printername variable to fit the default printer on the local machine?
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
Julian HansenCommented:
Oic - what you want to do is pick up the default printer of the client where the user is connecting to citrix from and then set that default printer on the Citrix / Terminal Server box?

Interesting, one of our products manages profiles and printers in a Citrix environment - but I am not going to discuss that here - ee ethics and all ;)

What I am going to say is if this is what you want to do then we have done exactly this for one of our clients as a freeware solution (sort of a teaser for the main product if you will). If you are interested let me know and I will post a link.

0
 
aslandkAuthor Commented:
of course i am interested...waiting for more info form you:):)
0
 
Julian HansenCommented:
Ok,

Here is the URL

http://www.managedprofile.com/downloads/mpdefprn.zip

The file contains a working executable that will set the default printer on the TS to the value set on the client. The file also contains the C/C++ source for doing this should you wish to modify it.

HTH
0
 
aslandkAuthor Commented:
i have downloade the code...but there is not any "readme.txt" or installation/user guide.

Do you have a guide i can use?
0
 
Julian HansenCommented:
Oops - my apologies - very simple utility - just run it in the user Citrix / Terminal server session. It does not require installation or command line parameters - just need to run it.

The source code should be included so you can take a look at what it is doing - if you have problems with the C++ let me know I will see what I can do about posting a VB version.

Julian
0
 
aslandkAuthor Commented:
if you have the code in vb i would prefere it...it looks very interesing:)
0
 
Julian HansenCommented:
Don't have it yet - but let me see what I can do.
0
 
aslandkAuthor Commented:
perfect:):)
0
 
Julian HansenCommented:
Done,

That was not a lot of fun - quite frankly I prefer the C/C++ implementation - a lot simplier.

Anyway here it is

http://www.managedprofile.com/downloads/mpdefprnVB.zip

The archive contains a VB version of the mpdefprn.exe and the source code to create it.

As with the C/C++ version it is a command line utility you run in the TS session you want to set the default printer for.

Let me know how you get along.

Julian
0
 
aslandkAuthor Commented:
thanks...going home from work now....will look at it tomorrow....do the user need to run it everytime the user is logging on to citrix?

0
 
Julian HansenCommented:
Yes, probably - it depends how your profiles are set-up but I would recommend you run it at login (login script or startup director or Run key) or give the user an icon to run it. Remember this is a simple utility to demonstrate the functionality - if you want something a little more fancy you will need to modify it to suite your needs.
0
 
Julian HansenCommented:
Aslandk,

How did you get on with the code I posted - did it work for you?

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

  • 8
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now