I'm trying to get correct screen resolutions from remote computers using Invoke-Command and a PSSession but both methods report one resolution of 1024 x 768. There are two screens, 1920 x 1080 and 1280 x 720. This is not a DPI thing.
Executing the code below (remotely) outputs the below snippet. Executing interactively, the correct resolutions are reported. All the other working methods posted online have the same behavoir.
Output:
PS > Add-Type -AssemblyName System.Windows.Forms
PS > [System.Windows.Forms.Screen]::AllScreens
BitsPerPixel : 0
Bounds : {X=0,Y=0,Width=1024,Height=768}
DeviceName : WinDisc
Primary : True
WorkingArea : {X=0,Y=0,Width=1024,Height=768}
It's surprising nothing in CIM can get these details from MULTIPLE monitors remotely, that I have found. Maybe time for a feature request to beef up some CIM cmdlets in 7.
I guess a workaround could be creating a Scheduled task on all target computers that runs a script locally to output the info to a local file, then use remoting to get the file or data.
If anyone has overcome this, your feedback would be greatly appreciated amongst the rest of us with this roadblock.
PowerShell 7:
Name Value
---- -----
PSVersion 7.0.1
PSEdition Core
GitCommitId 7.0.1
OS Microsoft Windows 10.0.18363
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Windows PowerShell:
Name Value
---- -----
PSVersion 5.1.18362.752
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.18362.752
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Windows 10 Pro