Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsWindows Server 2003Windows 2000Windows NTSmall Business ServerVirtual ServerExchange ServerIISHost Integration ServerISA ServerSMSWSUSMOMWindows Media ServerSecurityCertification
Related Topics
SQL ServerMS WindowsMS OfficePC HardwareMore Topics ...

Windows Server Forum / Windows 2000 / Terminal Services / May 2004

Tip: Looking for answers? Try searching our database.

TS, COM and environment variable corruption

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
TonyP - 25 May 2004 22:21 GMT
I am launching a batch script that sets a load of environment variables, and then starts a java process, and this uses COM to start an instance of excel. The environment variables in my excel instance are clipped and some are missing altogether.  At first I thought I was hitting some windows limit, but it turns out that running this same script logged directly into the server (ie with a keyboard and monitor) works perfectly

It appears terminal services is somehow interfering with COM in a strange way...  Is there a solution to this?  (I am using win 2000 sp4
Thanks
Tony
Patrick Rouse [MVP] - 27 May 2004 02:31 GMT
What program are you using to set the environment variables?  I'm assuming you know that the normal SET command only works for the current instance of cmd.exe when run on an NT based OS

There's a resource kit utility to facilitate this

Patrick Rous
Microsoft MVP - Terminal Serve
http://www.workthin.co
   
    ----- TonyP wrote: ----
   
    I am launching a batch script that sets a load of environment variables, and then starts a java process, and this uses COM to start an instance of excel. The environment variables in my excel instance are clipped and some are missing altogether.  At first I thought I was hitting some windows limit, but it turns out that running this same script logged directly into the server (ie with a keyboard and monitor) works perfectly
   
    It appears terminal services is somehow interfering with COM in a strange way...  Is there a solution to this?  (I am using win 2000 sp4
    Thanks
    Tony
Tony P - 30 May 2004 23:16 GMT
Yes I am using the SET command, and am deliberately exploiting the fact that the environment can be changed in one instance of cmd.exe.  The whole script works fine on my normal desktop, and on the server when logged directly into it.  It just doesn't work when logged in via Terminal Services

I am invoking an instance of excel via COM, and excel (excel 2000) is recieving a corrupted environment.  This issue only arrises when using TS.  A modified script that launches excel directly still manages to run my program (the needs the environment to get dlls and files), so I am guessing the issue is to do with TS and COM

My current workaround is to use Daimeware instead of TS, but TS is a lot smoother so it would be nice to be able to log in via TS

A minimal test case of the bug is to log into a machine with TS, and run a script that sets some dummy variable.  Then launch excel (preferably via COM - I have noticed some corruption of a long PATH variable without COM although it doesn't stop my program from working).  Then in excel, go into the visual basic editor and open the immediate window, and type shell "cmd.exe".  Then in that window type SET to print out all the environment.  There may be an easier way to get the environment from within VB, but in any case that should show the corruption.  Please tell me if you manage to reproduce this..
Tony
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.