Jump to content

Detect if PC is at Login screen (Ctrl+Alt+Del)


Recommended Posts

Hello,

We use AutoIt to write silent install/upgrade scripts for our organisation which are then sent to user's PC's (XP/2000) by software delivery.

The installs can take place during the day so we need to handle the following scenarios:

1. The PC is at the login screen (Ctrl+Alt+Del) - Silent Install

2. The PC is loggged in but the person is not using the application we are installing/upgrading - Popup at Start and Complete

3. The PC is logged in and the person is currently using the application we are installing/upgrading - Popup asking to close App and then at Complete

During the install I want to make it popup messages if someone is logged in (ie telling them to exit the application, or that the upgrade has finished and they can use the PC again) but if they are not logged in I want it to run completely silently.

I did try reading the @Username variable, but as the script is running via software delivery, using elevated permissions, the @Username is always SYSTEM and reading HKEY_CURRENT_USER reads the SYSTEM registry entry instead of the currently logged in users one.

Any help greatly appreciated.

Edited by NiVZ
Link to comment
Share on other sites

Try this:

Func IsLocked ()
    Return (WinGetProcess ("") > 999999)
EndFunc

[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

Link to comment
Share on other sites

You cannot detect when a computer is at the login screen because you script can't run in that state..

From msdn

A service application conforms to the interface rules of the Service Control Manager (SCM). It can be started automatically at system boot, by a user through the Services control panel applet, or by an application that uses the service functions. Services can execute even when no user is logged on to the system.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Sorry I should have made it more clear. I compile the AutoIT script to a .exe and then send the compiled script to the remote PC using software delivery which allows me to run scripts while the remote PC is at the login screen.

Ok, i'll restate that:

You can't run an AutoIt script without loggin in without a service wrapper.

There are non-AI programs that can run other programs like AutoIt exe's as a (fake?) service.

Edited by NiVZ
Link to comment
Share on other sites

While 1
    Sleep(1000)
    If _isWorksatationLocked() Then ConsoleWrite(@HOUR & ":" & @MIN & ":" & @SEC & " - " & "workstation locked" & @CRLF)
WEnd

Func _isWorksatationLocked()
    If StringInStr(WinGetText(""), "Program Manager") <> 0 And WinGetTitle("") = "" Then Return 1
    Return 0
EndFunc   ;==>_isWorksatationLocked

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Thanks for the replies, but I think I've misled some of you - I don't want to check if the workstation is locked. I need to check if the PC is logged out completely (ie switched on and waiting to login or Shutdown -> logoff)

I'm going to try the WinGetTitle and check if the window title of the login box is there so thanks for pointing me in the right direction muttley

Link to comment
Share on other sites

  • 2 months later...

Hello,

We use AutoIt to write silent install/upgrade scripts for our organisation which are then sent to user's PC's (XP/2000) by software delivery.

The installs can take place during the day so we need to handle the following scenarios:

1. The PC is at the login screen (Ctrl+Alt+Del) - Silent Install

2. The PC is loggged in but the person is not using the application we are installing/upgrading - Popup at Start and Complete

3. The PC is logged in and the person is currently using the application we are installing/upgrading - Popup asking to close App and then at Complete

During the install I want to make it popup messages if someone is logged in (ie telling them to exit the application, or that the upgrade has finished and they can use the PC again) but if they are not logged in I want it to run completely silently.

I did try reading the @Username variable, but as the script is running via software delivery, using elevated permissions, the @Username is always SYSTEM and reading HKEY_CURRENT_USER reads the SYSTEM registry entry instead of the currently logged in users one.

Any help greatly appreciated.

Did you ever find a solution to this?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...