I recently needed to be able to automatically set the display resolution during operating system deployment. I couldn’t get the resolution to change by setting the XResolution and YResolution MDT properties so I put together the following solution.
After following a thread on a myITforum mailing list about the same issue I put together this solution using this Video Resolution Changer which worked best for me out of the bunch that were mentioned. You could swap it out for another EXE by modifying the script.
The display resolution is configured automatically during deployment by running ResSwitch.vbs as a step in the task sequence. I started with this Speed/Duplex script and modified it to set the resolution instead, using ResSwitch.ini to hold the configuration.
ResSwitch.ini uses the following format:
[HWP2694]
;HP L2045w
WIDTH=1680
HEIGHT=1050
Where the string between the brackets must be found in the “PNPDeviceID” WMI value in the root\cimv2\Win32_DesktopMonitor class. Lines beginning with “;” are ignored. You must include WIDTH and HEIGHT entries to specify the desired display resolution. All displays will be set to 32-bit colour depth and 60Hz refresh rate.
To retrieve the PNPDeviceID value in order to add a new monitor to ResSwitch.ini you can run the following:
1. Open a Command Prompt
2. Run “wmic desktopmonitor list full”
3. Look for the PNPDeviceID value and select a subset to use as the search string. Typically the value between the backslashes will work best.
To use the script just unzip the ResSwitch.zip file below, download the Video Resolution Changer and copy 1365VidChng.exe to the same folder. Then run ResSwitch.vbs, i.e., “cscript ResSwitch.vbs”.
It would be cool to collect a whole bunch of PNPDeviceIDs with resolutions to build a comprehensive INI file. Feel free to post yours in the comments and I’ll add it to the file!













Pingback: Automatically Setting Display Resolution | System Center Ideas - Rod Trent at myITforum.com
#1 by world free on January 13th, 2010
Quote
works great when running manually but doesn’t seem to change anything as part of a task sequence. logs show that it ran fine…just no resolution change. any advice on the task sequence?
here’s a couple of entries as well
[LGD0000]
;Dell E6400 with Privacy Filter
WIDTH=1280
HEIGHT=800
[LEN4022]
;Lenovo T60p
WIDTH=1400
HEIGHT=1050
#2 by Chad Ingles on January 13th, 2010
Quote
If it works interactively then it should work via task sequence. You could add a pause at the end of the script, or wrap the script in a batch file with a pause to see if it is actually executing. I would check the command-lines and startup/working directories depending on whether you added it as an Application or are running it directly using “Run Command Line” in the TS.
If you add a pause during the TS execution you can also double-check the WMI lookup results and compare it to the string you’re trying to match.
Let me know how it goes!
#3 by zmobile on February 2nd, 2010
Quote
I cannot seem to get this to work with windows 7 64bit. It does work with Windows XP. The Windows 7 does not error out and shows the contents of the .ini file, but it does not call the video changer app
#4 by Jay on February 18th, 2010
Quote
Where at in the TS do you put this?
#5 by Chad Ingles on February 18th, 2010
Quote
Somewhere after the target OS is installed, typically around the Install Applications step in the Standard Client Task Sequence.
#6 by Ward on March 19th, 2010
Quote
[SEC3846]
;HP Elitebook 8530w
WIDTH=1680
HEIGHT=1050
#7 by Victor on June 23rd, 2010
Quote
Not Working on Windows 7…
#8 by Victor on June 23rd, 2010
Quote
Got It…. Nice!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! works great!!!!!
Pingback: Automatically set display resolution - Brandon Linton @ myITforum
#9 by Rasmus on July 1st, 2010
Quote
Having issues getting it working on windows 7 64bit aswell.
I’m getting this error:
ResSwitch.vbs(18, 2) Microsoft VBScript runtime error: Type mismatch
Any suggestions?
#10 by Iliana Janisch on July 5th, 2010
Quote
My personal adhere to the website regarding pretty the along with may inform that the posts always prove to of unparalleled combination and also very good quality regarding audience.
#11 by pasi kuikka on July 19th, 2010
Quote
Hi, and thanks for this great script. I had to change it little to get it work.
original:
For Each oDesktopMonitor in colDesktopMonitors
PNPDeviceId = oDesktopMonitor.PNPDeviceId
WScript.Echo PNPDeviceID
Exit For
Next
modified:
For Each oDesktopMonitor in colDesktopMonitors
If (oDesktopMonitor.PNPDeviceId “”) Then
PNPDeviceId = oDesktopMonitor.PNPDeviceId
WScript.Echo PNPDeviceID
End If
Next
That was because one model reported ‘null’ for first display. The error was:
ResSwitch.vbs(18, 2) Microsoft VBScript runtime error: Type mismatch
PS. Also, the 1365VidChng.exe command in the end should be with @ mark in it, like 1280x800x32@60
PPS. Sorry for my horrible English
#12 by pasi kuikka on July 19th, 2010
Quote
As addition to my previous comment:
Seems like this webpage doesn’t like less-than and greater-than symbols, which should be in IF statement providing “if not” operation between oDesktopMonitor.PNPDeviceId and “”
#13 by pasi kuikka on July 26th, 2010
Quote
I just figured out that the easiest way to set correct resolution is just modify file: deploymentshare\control\unattend.xml.
Find display settings in Microsoft-Windows-Shell-Setup section and delete all those lines between starting tag “” and ending tag “”
There is some hard coded resolution 1024 x 768…
After this the recommended resolution is picked up automatically.