Hi Miko,
Welcome to the Forum.
What script / program code have you created to take advantage of the call to PowerManager.IsMonitorOn?
Back in the days of Windows Vista, and Windows 7 too Power Manager scripts were predominantly coded in either C# or VB as opposed to PowerShell. Are you attempting to use an older Script withing the PowerShell environment?
If you are using a script provided by a third party opposed to one you coded yourself, there is also a high probability it includes a time delay on reporting events? That used to be a popular thing to do in coding such management style programs, because the older Shell programs unlike PowerShell were not able to pipe results from one Command to another instantaneously, but instead had to wait for all result sets to complete. Thus you may find a block of code hiding in your program / script that uses a conditional loop to force a timeout of reporting an event.
To give further advice on your stated issue, I'd really need to get some answers to my initial questions, and if possible review the code you are working from.
In terms of PowerShell though, you could probably play around with the Get-WmiObject cmdlet.
Here is a sample of what you can do using that cmdlet within PowerShell:
Code:
Clear-Host
Get-WmiObject WmiMonitorID -Namespace root\wmi |
Select @{
n = "Manufacturer"
e = { [System.Text.Encoding]::ASCII.GetString($_.ManufacturerName -ne 00) }
},
@{
n = "Model"
e = { [System.Text.Encoding]::ASCII.GetString($_.UserFriendlyName -ne 00) }
} | Format-Table
That assumes this.object is in a state of on hence the -ne 00