Windows Tip Sheet
Make a New Year's Resolution with Scrnres
Output the screen resolutions for your network's computers with a simple admin tool.
I recently stumbled across a mirror site of
Frank
Westlake’s utilities page, a site that has more Windows
administrative tools than you can shake a stick at. I was actually
searching for a way to help a client of mine, who needed to document
the screen resolutions his users were using on their computers.
After giving up on a VBScript-based solution (I just couldn’t
find a way to dig that information out and didn’t have a lot
of time to try), I started looking for a tool that would do it for
me. Google led me to Frank Westlake’s site, where I felt like
I’d hit the utility jackpot.
Screen Resolution Inventory
Okay, I’ll admit up front that what I’m about to do
isn’t pretty, but it works. First,
the above Web site lists a tool named Scrnres, which displays the
resolution of the computer’s screen. You get a simple output,
like “1024 x 768” or “800 x 600.” My client
needed to find all of those 800 x 600 folks, because a new corporate
app requires at least 1024 x 768 resolution.
I could have written a VBScript that ran the Scrnres tool and captured
its output, and then logged that information, along with the current
user name and computer name, to a text file or database. Looking
back, that would have been the way to go. At the time, however,
time was of the essence, and I found this tip
on JSI FAQ, which offered a quick way out, using the same Scrnres
tool.
The tip’s author wrote a batch file:
for /f "Tokens=1,3" %%x in ('scrnres')
do (
set /a ScreenX=%%x
set /a ScreenY=%%y
)
This sets a ScreenX and ScreenY environment variable containing
the current screen resolution. Nifty, because I knew I could write
a VBScript that could extract that environment information into
variables, and once you’ve got something in a variable you
can do anything with it. My client put it all together into a file
that logged the information in an Access database. You could take
a simpler approach and do something like this:
for /f "Tokens=1,3" %%x in ('scrnres')
do (
set /a ScreenX=%%x
set /a ScreenY=%%y
)
echo Your resolution is %%x by %%y. If this is ‘800 by 600’,
contact the Help Desk immediately for further instructions.
pause
Not pretty, but it gets the message across without too much fuss
and bother. Make sure you let the Help Desk know it’s coming
(grin).
More Resources:
About the Author
Don Jones is a multiple-year recipient of Microsoft’s MVP Award, and is Curriculum Director for IT Pro Content for video training company Pluralsight. Don is also a co-founder and President of PowerShell.org, a community dedicated to Microsoft’s Windows PowerShell technology. Don has more than two decades of experience in the IT industry, and specializes in the Microsoft business technology platform. He’s the author of more than 50 technology books, an accomplished IT journalist, and a sought-after speaker and instructor at conferences worldwide. Reach Don on Twitter at @concentratedDon, or on Facebook at Facebook.com/ConcentratedDon.