Page 1 of 1 1
Topic Options
#195460 - 2009-08-19 12:28 PM IF RDP session = 1 exit
metatron Offline
Fresh Scripter

Registered: 2008-05-06
Posts: 27
Loc: london
hi all

i have a printer removal script that runs at logon. it stops if its a TSSession but not for an RDP session. how do i stop it from running if this is the case?

cheers

Top
#195461 - 2009-08-19 03:39 PM Re: IF RDP session = 1 exit [Re: metatron]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Have you looked at @RAS
_________________________
Today is the tomorrow you worried about yesterday.

Top
#195462 - 2009-08-19 04:26 PM Re: IF RDP session = 1 exit [Re: Gargoyle]
metatron Offline
Fresh Scripter

Registered: 2008-05-06
Posts: 27
Loc: london
IF @RAS = 1
goto End
ENDIF

would that do the trick?

Top
#195463 - 2009-08-19 04:30 PM Re: IF RDP session = 1 exit [Re: metatron]
metatron Offline
Fresh Scripter

Registered: 2008-05-06
Posts: 27
Loc: london
this seems to work when using RDP from desktop but if you are in Virtual Infrastructure client and use the console from there to access a server it still runs. does anyone know how to exclude this also?

Edited by metatron (2009-08-19 04:31 PM)

Top
#195464 - 2009-08-19 07:09 PM Re: IF RDP session = 1 exit [Re: metatron]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4403
Loc: New Jersey
This is from our commercial login script:
 Code:
; Determine login type - direct, Terminal Server, or Citrix
; Con=Direct Console, RDP=Terminal Server, or ICA=Citrix
$ConnType = Left(%SESSIONNAME%, 3)
; Get list of connection types allowed to run login scripts
$Tag = ReadProfileString($INIFILE, 'COMMON', 'ConnType')
; If Connection Type Allow list is defined, current ConnType must be in list
If $Tag					; defined
  If Not InStr($Tag, $ConnType)		; if not in list
    DbgMsg('Invalid connection type - exiting.')
    Exit 0				; exit script
  EndIf
EndIf

"$Tag" can contain a list of allowed connection types in a space or comma-delimited string. If $Tag contains "ICA", the process will exit if the connection type is CONsole or RDP.

You might want to reverse the logic.. start by replacing the Exit with a result message, and hard-code the $Tag value for testing. This might get you going in the right direction.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#195472 - 2009-08-20 09:52 AM Re: IF RDP session = 1 exit [Re: Glenn Barnas]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
This inspired me to do this: SessionType() UDF. Simple but effective.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#195473 - 2009-08-20 11:37 AM Re: IF RDP session = 1 exit [Re: Mart]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Dim $Session too please ;-)
Top
#195474 - 2009-08-20 11:40 AM Re: IF RDP session = 1 exit [Re: Arend_]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Done.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#195475 - 2009-08-20 11:46 AM Re: IF RDP session = 1 exit [Re: Mart]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Very nice UDF btw!!!
Has my vote to be incorporated into the next build of KiX.

Top
#195476 - 2009-08-20 12:03 PM Re: IF RDP session = 1 exit [Re: Arend_]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Yep. Simple but effective.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1894 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.26 seconds in which 0.12 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org