Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for getres.vbs

(view source code of getres.vbs as plain text)

  1. On Error Resume Next
  2. strMsg = vbCrLf
  3.  
  4. ' Display help if any command line parameter is specified
  5. If WScript.Arguments.Count Then
  6. 	strMsg = strMsg _
  7. 	       & "GetRes.vbs,  Version 1.00 for Windows 2000" & vbCrLf _
  8. 	       & "Display screen resolution and refresh rate" _
  9. 	       & vbCrLf & vbCrLf _
  10. 	       & "Usage:  CSCRIPT  GETRES.VBS" _
  11. 	       & vbCrLf & vbCrLf _
  12. 	       & "Written by Rob van der Woude" & vbCrLf _
  13. 	       & "http://www.robvanderwoude.com" _
  14. 	       & vbCrLf & vbCrLf _
  15. 	       & "Created with Microsoft's Scriptomatic tool" & vbCrLf _
  16. 	       & "http://www.microsoft.com/technet/treeview/default.asp" _
  17. 	       & "?url=/technet/scriptcenter/WMImatic.asp" _
  18. 	       & vbCrLf & vbCrLf & vbCrLf
  19. End If
  20.  
  21. ' Retrieve information
  22. Set objWMIService = GetObject( "winmgmts://./root/cimv2" )
  23. Set colItems = objWMIService.ExecQuery( "Select * from Win32_DisplayConfiguration", , 48 )
  24.  
  25. ' Format output
  26. For Each objItem in colItems
  27. 	strMsg = strMsg _
  28. 	       & "VideoCard   : " & objItem.DeviceName & vbCrLf _
  29. 	       & "XResolution : " & objItem.PelsWidth & vbCrLf _
  30. 	       & "YResolution : " & objItem.PelsHeight & vbCrLf _
  31. 	       & "BitsPerPel  : " & objItem.BitsPerPel & vbCrLf _
  32. 	       & "VRefresh    : " & objItem.DisplayFrequency & vbCrLf
  33. Next
  34.  
  35. ' Display the result
  36. WScript.Echo strMsg
  37.  

page last modified: 2024-04-16; loaded in 0.0178 seconds