PC Review Forums Newsgroups Windows 2000 Microsoft Windows 2000 Terminal Server Clients TS, COM and environment variable corruption

Reply

TS, COM and environment variable corruption

 
Thread Tools Rate Thread
Old 25-05-2004, 10:21 PM   #1
=?Utf-8?B?VG9ueVA=?=
Guest
 
Posts: n/a
Default TS, COM and environment variable corruption


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
  Reply With Quote
Old 27-05-2004, 02:31 AM   #2
=?Utf-8?B?UGF0cmljayBSb3VzZSBbTVZQXQ==?=
Guest
 
Posts: n/a
Default RE: TS, COM and environment variable corruption

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
  Reply With Quote
Old 30-05-2004, 11:16 PM   #3
=?Utf-8?B?VG9ueSBQ?=
Guest
 
Posts: n/a
Default RE: TS, COM and environment variable corruption

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
  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off