I like to create poweshell scrip for user screen lockout

How can i create the PS script for user pc screen lock out after 10 minutes.

Thnaks,

Preyash

Preyash,
Welcome to the forum. :wave:t4:

This forum is for scripting questions rather than script requests. We do not write customized and ready to use scripts or solutions on request.

We actually expect you to make an own attempt at the first place to get your task done or to solve your problem. If you have done so already please document here what exactly you have done and show your code. Then we probably might be able to help you step further.

What exactly do you mean actually? Do you want to log out the user on inactivity? What’s with unsaved changes the user has in its session?

If you want to lock a workstation in an enterprise environment after 10 minutes inactivity you would use a GPO - not a script. :wink:

Hi Olaf,
i like to do screen lock only not logout.
Thanks for your quick reply. We are on Azure AD not on the local AD. i know i can use GPO but like to use PS script and like to force from endpoint management system.

Many thanks,
Preyash

So you should search for a way to configure the energy settings / lock screen settings by a PowerShell script.

I did but could not find it. if you know please let me know.
Thanks,

Preyash