How to Prevent System from Locking during Script run ?

QTP scripts fail to execute when the system is locked/minimized. In order to make your script work when the remote machine on which you are executing is minimized, you can read one of my posts –

Now that “minimized” is taken, lets take on “locked” ! There are two ways which I use to prevent system unlock, the first one is :-

1. Using a Third Party tool called Caffeine – This is a simple exe which prevents your system from getting unlocked by simulating certain events. It can be downloaded from –

2. Using Registry to disable locking of the Workstation – I feel that this is the most effective way to do this. This is how you can set this up :-

Open up regedit.exe through the start menu search box, and then browse down to the following key, creating it if it doesn’t exist:



On the right-hand side, create a new DWORD 32-bit value named DisableLockWorkstation and give it one of these values:

  • 1 – Disable Lock Workstation
  • 0 – Enable Lock Workstation

The changes should be immediate, no need to restart anything.

Courtesy –

Happy Automating !

Harshit Kohli


One thought on “How to Prevent System from Locking during Script run ?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s