OS and Software Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > OS and Software >

 OS and Software Operations

GUS. -  Get Usage State

Previous Top Next


MiniRobotLanguage (MRL)

 

GUS. Command

Get Desktop name and Info if script runs without user logged on

 

 

Intention

 

This command will get the current desktop of the script as well as the current input-desktop of the user.

This way the command can find out, if a user is logged on or not.

 

 

There are 3 ways to use GUS.

 

1. GUS. without any parameter will place a values on TOS:

 

0 - the user is currently logged on

1 - the script runs at logon screen

    technically: the input-desktop is NOT the desktop which the script runs on.

 

 

2. GUS. with one parameter. Like this:

 

will return the result of the operation on TOS. Example:

 

GUS.log-off state

DBP.$$000

 

 

3.GUS. with 2 parameters, like this:

 

GUS.log-off state|$$RET

 

Will return the result of the operation in the given variable. Example:

 

GUS.log-off state|$$RET

DBP.$$RET

 

Hint:

To find out, if a user has just locked his client, you can use IEP. to check if a process "explorer.exe" is currently running.

 

 

 

 

Syntax

 

 

GUS.[P1][|P2]

 

 

Parameter Explanation

 

 

P1 - (optioal)  Subcommand, one of the following:

 

   "acs-id","ai"

returns The session identifier of the session that is attached to the physical console. If there is no session attached to the physical console, (for example, if the physical console session is in the process of being attached or detached), the return value is a value that is not one of the valid session-id's which you can get using the GSD.-command.

 

   "ir","is

The return code to this subcommand consists of two parts:

Part I: If the calling process is associated with a Terminal Services client session, the return value is 1. If the calling process is associated with the Terminal Services console session, the return value is 0.

Part II: is used in a Terminal Services environment to determine if the current Terminal Server session is being remotely controlled. Its value is 1 if the current session is remotely controlled; otherwise, 0.

 

   "dn","desktop name"

Returns the name of the desktop which is the desktop of the current running script.

 

   "id","input desktop"

Returns the name of the desktop that is currently connected with the mouse and screen.

 

   "log-off state","los"

Checks if the two desktops have the same name - or not. In that case, its possible that the station is logged off. Note that this will only work as long as the user and the script run in the same session. If that is not the case, both could use desktops with the same name, while being different desktops. If necessary, check the session ID also, using GSD.    

 

P2 - (optioal)  Variable for the result. If omitted, TOS is used.

 

 

 

 

Example

 

 

'-----------------------------

'

'-----------------------------

GUS.log-off state|$$RET

DBP.$$RET

END.

 

 

'-----------------------------

'

'-----------------------------

SER.restart|dn:interactiv

DOL.1

 GUS.los

 PRT.los=$$000

 GUS.id

 PRT.id=$$000

 GUS.dn

 PRT.dn=$$000

 PAU.3

OOP.

ENR.

 

 

 

Remarks

 

There are huge differences about the handling of desktops and sessions, before and after windows Vista.

After Vista, all system services run in session 0, that does not have a interactive desktop. The user desktop is in session 1.

Before Vista, services and user-desktop were in session 0. Desktops will always have different names, unless they are not in the same session. Mostly there is a desktop named "default" and a desktop named "WinLogon" in each session.

If no user is logged on, then the Input-Desktop will possibly be the "WinLogon".

 

 

 

 

Limitations:

 

-

 

 

See also:

 

    GSD. - Get Session Data