During the PowerShell Deep Dive @ TEC, a presenter asked if it was possible to change the monitor resolution in PowerShell. I happened to have run across a nifty little cmdlet already on your machine that can do the trick, so I'm blogging it out for posterity.
It's in the diagnostic scripts. In case you don't know about them, they're a set of PowerShell scripts used by windows whenever you click "troubleshoot this problem" in windows. This is how your grandmother uses PowerShell almost every day even if she doesn't realize it.
The whole set of diagnostic scripts are in c:\Windows\diagnostics. It's a hodgepodge of a lot of really cool scripts, but the thing that let's us change the resolution is in a little cmdlet delcared in C:\Windows\Diagnostics\System\Aero\MonitorSnapin.dll that can do the trick.
Here's how you'd change your resolution:
Import-Module $env:windir\diagnostics\system\aero\MonitorSnapIn.dll
Get-Monitors | ForEach-Object { $_.ChangeResolution((New-Object Microsoft.Windows.Diagnosis.SystemInfo.MonitorInfo.Resolution 1024,768)) }
And that's it. Once you know where to look, it's not too hard to change the monitor resolution in PowerShell.
Hope this Helps,
James Brundage - Founder
Start-Automating