#36484 - 2003-02-14 05:14 AM
Detect Terminal Session
|
Austin
Seasoned Scripter
Registered: 2002-01-24
Posts: 439
|
Does anyone know how to detect if the user is in a Terminal Session or not? Basically I want to know if the user is logged in through console or TS when I process my script.
Thanks
_________________________
Austin Henderson
|
|
Top
|
|
|
|
#36486 - 2003-02-14 11:43 AM
Re: Detect Terminal Session
|
Austin
Seasoned Scripter
Registered: 2002-01-24
Posts: 439
|
In a Terminal session @ProductSuite returns Windows 2000 Server (even though it is actually 2000 Advanced Server) and the sessionname returns console as expected in a console logon. @ProductType returns 18 which I dont see in the docs. I can work with the %sessionname% variable and check for the presence of RDP in the string.. thanks for the direction.
_________________________
Austin Henderson
|
|
Top
|
|
|
|
#36487 - 2003-02-14 01:35 PM
Re: Detect Terminal Session
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Austin, I think you have @ProductSuite and @ProductType backwards.
If @ProductSuite returns 18 you have to process it like: code:
Function ProductSuite ($Product) Dim $Product
select case $Product = "None" $x=0 case $Product = "Small Business" $x=1 case $Product = "Enterprise" $x=2 case $Product = "BackOffice" $x=4 case $Product = "CommunicationServer" $x=8 case $Product = "Terminal Server" $x=16 case $Product = "Small Business (Restricted)" $x=32 case $Product = "Embedded NT" $x=64 case $Product = "DataCenter" $x=128 case $Product = "Single User Terminal Server" $x=256 case $Product = "Home Edition" $x=512 case $Product = "Blade Server" $x=1024 case 1 $RC=MessageBox ("Invalid parameter used in function ProductSuite ($Product)",48) WriteLog("Invalid parameter used in function ProductSuite ($Product)") endselect
$ProductSuite = $x & val(@ProductSuite) Endfunction
the number requires bitwise processing. [ 14. February 2003, 13:36: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#36489 - 2003-02-14 05:06 PM
Re: Detect Terminal Session
|
Austin
Seasoned Scripter
Registered: 2002-01-24
Posts: 439
|
So moving forward I can expect to return what in future builds for @ProductSuite?
Thanks
_________________________
Austin Henderson
|
|
Top
|
|
|
|
#36491 - 2003-02-14 05:21 PM
Re: Detect Terminal Session
|
Austin
Seasoned Scripter
Registered: 2002-01-24
Posts: 439
|
Miscommunication there.. sorry my bad. I meant with regard to this... quote: On KiX versions prior to 4.2x, @ProductSuite returned a string VarType, hence the Val() in Howard's UDF.
Is this the method as we move forward? Builds of Kix32.exe.
Thanks
_________________________
Austin Henderson
|
|
Top
|
|
|
|
#36493 - 2003-02-14 05:39 PM
Re: Detect Terminal Session
|
Austin
Seasoned Scripter
Registered: 2002-01-24
Posts: 439
|
Ohh I know it is being improved.. wasnt asking with any bit of doubt regarding the product just thinking ahead on my script.
Glad to know..
Thanks
_________________________
Austin Henderson
|
|
Top
|
|
|
|
#36494 - 2003-02-14 06:16 PM
Re: Detect Terminal Session
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
You can use the VarType() function to determine if your current version is returning a string or number. That way it won't matter when you upgrade.
|
|
Top
|
|
|
|
#36496 - 2003-02-14 06:27 PM
Re: Detect Terminal Session
|
Austin
Seasoned Scripter
Registered: 2002-01-24
Posts: 439
|
Sure I got you.. wasnt trying to get out of testing just didnt know I could get 4.2 yet.. The latest I se on DL is 4.12.
Thanks for your help guys...
Hey let me pose this question to the board. Without building a timer or something I am wondering if it is quicker to connect to a printer at each logon or check to see if it exists then connect only if it is not needed.. are there any other reasons for one or the other method?
Thanks so much..
_________________________
Austin Henderson
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|