Location based terminal server logon script


I have a questions to which I can't seem to find any documentation on the net.

I have a few clients which use terminal services. Currently when a head office user goes to a brach office all his printers are still defaulted to the head office one's as that is his group membership which the currently logon script works off.

What i'd like to achieve is to create a logon script which either grabs the client device name, or client IP address and based on that assigns a set of printers and default printers which apply in this location. This would then mean that it doesn't matter who logs onto the workstation, but only which workstation logs on. If there's some sort of variable in vbs i can use to grab the client device name please let me know! i tried session name which only returns the computer name of the terminal server...

Any help or pointing into the right direction would be an absolute godsend!!

Thanks to all in advance! :-)
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hello txsolutions,

To accomplish this by using a script would be an administrative nightmare.  Each time a printer was deleted, added, or changed, the scripts would have to be modified to reflect that.  I would recommend setting up printer locations.  It detects which site a user is located at and alters the search for printer feature in AD.  When the user want to print, they search AD and only the printers in the site show up.  Of course they are all named with names that clearly identify them.  Here is a link to set it up.


txsolutionsAuthor Commented:
Hi Cfairley,

firstly, thanks alot for the quick reply to my question! :-)

The situation is more relative to smaller sites with rather static configurations. They also run a custom application which statically points to printer queues based on the login name. This is of course a problem when that users moves from site to site. One of the things that this application however can do is point to the default printer queue. Thus my thought was, if i set up all terminals with a 3 character prefix per location and then map printers based on that prefix of the terminal i can assign the correct default printer to the user and then this problem is solved.

I do take onboard though the warning of the increased admin overhead when changes to the network occur, but as i said, these are smaller and quite static turn-key type networks which I'm dealing with at the moment. (last printer change for one particular site was back in 2001... :-) )

Any help is very muchly appreciated.

thanks again for the reply cfairley!
sorry about that!

Here is are some scripts I found:




After creating the script, you can create a new group policy and link it to various AD sites.  You can enter the script in the Computer Configuration/Windows Settings/Scripts.

Of course, this will not detect by computer name, but you can link it to sites or OUs if your OU structure is based off sites.

I'm off to bed, so I hope this helps some.  Talk to you tomorrow.  Thanks!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 2000

From novice to tech pro — start learning today.

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.