# [SOLVED] Terminal Server Redirections



## loda117 (Aug 6, 2010)

HI 
So I am trying to redirect com1 port on a local machine to a terminal server during session. 

Com1 is connected to the a weight scale and I can read off of it on the local machine but for some reason does not get redirected 
I have made sure that all the settings under RDP 5.2 are good and that it should map com1. It does map the network drives, printers etc but not the com1 

so i have tried using the net use during the session to see if it could manually map the com1 so i have used 
net use com1: \\tsclient\com1

but that also gives out an error and quits soo fast that i can't even read what the error was 

any help would be helpful or i am going to be stuck in Kansas city till i get it figured out lol 

thanks.


----------



## djaburg (May 15, 2008)

*Re: Terminal Server Redirections*

Is there an application that might be running that's locking to port to the host machine?


----------



## cluberti (Aug 26, 2010)

*Re: Terminal Server Redirections*

Did you look in the event logs on both client and server to see if there were any errors logged during your RDP session? I know that certain things can cause serial port mapping to fail (including driver support, devices that use odd serial port settings that are non-standard, etc).


----------



## loda117 (Aug 6, 2010)

*Re: Terminal Server Redirections*

No i have not seen the event log on either machines but i will tomorrow morning 

As for the application on host machine, I don't think so but i will check it out as well 

thank you for the respond


----------



## loda117 (Aug 6, 2010)

*Re: Terminal Server Redirections*

Alright so made sure that the com ports were being redirected and they were 

the problem was with the scale itself the serial connection settings had to be changed from default and after searching for a while I changed the settings and "boom" started working like a charm 

now I ran into another issue 
since the clients are remote and they both have their own LPT1 printers which are being redirected and it works perfectly fine. They use a program called "connectship" to print thier labels and write back the shipping info to our data base 
when one client logs off from the terminal server and reconnects the session ID changes and they can not print from the connectship because in there the dedicated printer is for example: "ws-lship1-ws7) session 1 but now the client is in session 2 
Is there any way that I can assign static session ID to client in terminal services in server 2003? 

or any other ideas you guys have 

thanks


----------



## cluberti (Aug 26, 2010)

*Re: Terminal Server Redirections*

You can force clients to always use the same session, but that only redirects them to an already logged-on session - if they log off, they will get the next available session ID when connecting. There's no getting around this and given how Windows Vista and Windows 7 work (they're basically terminal servers - you connect to the next available session, rather than session 0 which is no longer available to log on to), you might want to consider the future as well. Unfortunately, the old assumptions about sessions do not work in a TS environment, and they don't even work in desktop environments after Windows XP.


----------



## loda117 (Aug 6, 2010)

*Re: Terminal Server Redirections*

well I have found a work around sorta complicated since it requires a vb script to run within logon.bat to rename the default printer name to say "Zebra-SHIP04" every time the client RDP's in to the server it will change their default printer name to the one above thus making the connectship to print to the redirected printer from client's machine 

Thanks for the help


----------



## loda117 (Aug 6, 2010)

*Re: Terminal Server Redirections*

btw how can i force the clients to connect to the already logged on session?


----------



## cluberti (Aug 26, 2010)

*Re: Terminal Server Redirections*

Restrict Users to a Single Session


----------



## loda117 (Aug 6, 2010)

*Re: Terminal Server Redirections*

yup took care of it but it still is setting sessions up dynamically 

My vbscript is not coming along very well but I have been thinking if I can share the printers from the local machines maybe i will be able to install them on the server 
but that might not work since i am connected through vpn
but if it does then i can change each user's profile in connectship to get them their printer this way they won't change their names and take down printer redirection


----------



## cluberti (Aug 26, 2010)

*Re: Terminal Server Redirections*



loda117 said:


> yup took care of it but it still is setting sessions up dynamically


Initial sessions will indeed be set up dynamically, as I had previously mentioned. This just makes those sessions sticky rather than allowing users to get multiple sessions if they don't log off.


----------



## loda117 (Aug 6, 2010)

*Re: Terminal Server Redirections*

you are right still dynamic 

I have worked around right now that I can use a vb script to change the printer name 
I am trying to see if i can run the script through the logon.bat on start up 
Do you think this would work?


----------



## loda117 (Aug 6, 2010)

*Re: Terminal Server Redirections*

So the vb script runs and changes the defalt printer name without an issue 

but for some reason i am having hard time calling on the vb script from logon.bat any ideas


----------



## cluberti (Aug 26, 2010)

*Re: Terminal Server Redirections*

assuming the vbscript doesn't take any input or output anything to the screen, best bet is to call it during your logon script via a cscript call:

```
cscript <vbscript.vbs> //B //nologo
```


----------



## loda117 (Aug 6, 2010)

*Re: Terminal Server Redirections*

Here is the vb script that I am running 



> strComputer = "terminal-serv"
> Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
> 
> Set colPrinters = objWMIService.ExecQuery _
> ...


----------



## loda117 (Aug 6, 2010)

*Re: Terminal Server Redirections*

ok so in the session i am getting access denied when it tries to run with logon.bat 

c:\Documents and settings\VB Scripts\change.vbs 

Could i possibly set the group policy for these users to be able to run scripts?


----------



## loda117 (Aug 6, 2010)

*Re: Terminal Server Redirections*

ok a good news !!!!!  
I was able to run the script through the logon bat just had to dump the script back to on the dc in netlogon shared folder 
now the user logons to any session and gets their default printer mapped and then renamed by the script above 
I have to create different scripts for each user/machine but thats not a big d4 eal there are only 4

thank you guys  :wave:


----------



## cluberti (Aug 26, 2010)

Why not set the machine name as "." instead of each machine having their own script? The . == the local computer name.


----------



## loda117 (Aug 6, 2010)

Well because each machine has to have a different named printer otherwise the profiles will be confused to where to send the data to 

ok so i have got another issue 
if the script is not running through logon. bat for some reason 
I am not getting any errors or anything either


----------



## cluberti (Aug 26, 2010)

If they're set in group policy, you should start logging:

Fixing Group Policy problems by using log files: Group Policy


----------



## loda117 (Aug 6, 2010)

ok so i am not seeing any errors or issues 
but still the script is not running at logon


----------



## loda117 (Aug 6, 2010)

Finally got it to work 
i had to end up giving them the Printer Operators permission through AD's Groups and everything works like a charm


----------

