Get lid open or close state using powershell

Copper Contributor

I have a home laptop to which I have remote ssh access using Powershell. How can I get whether the lid is opened or close

4 Replies



You can list all currently active displays by using 

Get-CimInstance -Namespace root\wmi -ClassName WmiMonitorBasicDisplayParams


Then you narrow it down to the one you need, in this case my laptop screen is the one with the instance name containing 'LEN40a9'


Get-CimInstance -Namespace root\wmi -ClassName WmiMonitorBasicDisplayParams | Where-Object InstanceName -Match 'LEN40a9'


Then you can determine if it's open or closed by using:


if ((Get-CimInstance -Namespace root\wmi -ClassName WmiMonitorBasicDisplayParams | Where-Object InstanceName -Match 'LEN40a9').Active -eq 'True') {
write-host monitor lis is open} else {
write-host Monitor lid is closed
Did this work for you?

It is very old post. I think I used windows events to solve this that time.

Ah, that's also an option :)