VBS Script to Retrieve the Screen Resolution

UPDATE: I no longer use this method, instead take a look at this post VBS Script to get a computers screen aspect ratio

 

The below script will display the screen resolution of the computer.

I use this script as part of a logon script to deploy wallpaper

array_ScreenRes = GetScreenResolution
screenRes_X = array_ScreenRes(0)
screenRes_Y = array_ScreenRes(1)
 
wscript.echo "Resolution is: " & screenRes_X & " by " & screenRes_Y
 
Function GetScreenResolution()
	Set oIE = CreateObject("InternetExplorer.Application")
	With oIE
		.Navigate("about:blank")
		Do Until .readyState = 4: wscript.sleep 100: Loop
			width = .document.ParentWindow.screen.width
			height = .document.ParentWindow.screen.height
	End With
 
	oIE.Quit
	GetScreenResolution = array(width,height)
End Function

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.