?
Solved

How to identify terminal server session in a log in script.

Posted on 2001-08-30
11
Medium Priority
?
323 Views
Last Modified: 2010-05-18
Hi fellow Experts!

I wonder if someone can help me with this.

I am managing Terminal Server in the Windows 2000 Domain.
I have users who sometimes log in to Windows 2000 Domain via Terminal Server. All users have a login script assign to them, but Terminal server users shouldn't execute most of the commands in the script. I would like to be able in the beginning of the script to find out if a user is coming via Terminal Server session and exit the script. If user is a "normal" user all script commands should be executed.

Thanks!
0
Comment
Question by:mkoganov
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
  • +2
11 Comments
 
LVL 4

Expert Comment

by:darrenburke
ID: 6441312
what is you logon script?  Are you using KIX, VBS or just a .BAT file.  There are lots of ways to do this but need to know your scripting format.
0
 

Author Comment

by:mkoganov
ID: 6441478
This is just a *.bat file.
0
 

Author Comment

by:mkoganov
ID: 6441524
This is just a *.bat file.
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 10

Expert Comment

by:Longbow
ID: 6441534
Hi,
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions\ProductType=?

use resource kit tool or any script to read this keyname so you know wich OS is running then add the condition to the script

Longbow
0
 
LVL 4

Expert Comment

by:darrenburke
ID: 6441659
an easier option is to check the value of %COMPUTERNAME%, this will be the terminal server name.
0
 

Author Comment

by:mkoganov
ID: 6441684
No Longbow, that is not going to work in all the cases.
When the user is participating in terminal session on Windows 2000 Terminal Server his/her ProductType is ServerNT, when the same user is logging from Windows NT 4.0 Server his/her Product Type is ... ServerNT as well.
0
 

Author Comment

by:mkoganov
ID: 6441713
yes, %COMPUTERNAME% would probably work, with the exception when I am logging into Terminal Server locally.
0
 
LVL 10

Expert Comment

by:Longbow
ID: 6442358
Use any difference found in the Terminal Server.
These are surely specific registry keys.
If the difference is found the script may stop.

Longbow
0
 
LVL 5

Expert Comment

by:matt023
ID: 6443365
how about creating a blank file with, let say, a name called "terminal.txt" in c: of the terminal server.

at the beginning of the script, include:

if exist c:\terminal.txt goto end

and toward the end of the file, include:

: end

call the file whatever you wish and put it where ever you want on the terminal server.

a tag file method..
0
 

Accepted Solution

by:
mscheurer earned 400 total points
ID: 6444939
check the variable %SESSIONNAME%. The variable is set when you log on via Terminal Services. Otherwise it is undefined.

Example:
if not %SESSIONNAME%. == . exit




0
 

Author Comment

by:mkoganov
ID: 6444989
Yes, %SESSIONNAME% variable is what I was actually looking for.

It is undefined if not in terminal session, it is equal =
Console if physically locally working at Terminal Server and it has some value if going via Terminal session.

Thanks to all contributors and points to mscheurer.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
The Summer 2017 Scholarship Winners have been announced!
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question