VBScript: Screen Resolution
' Writes screen resolution to the Tools directory ' ' Written by Jason Olson ' Based on work by Microsoft Script Guy ' Find the tools directory, create it if missing ' Get the available logical drives and load them into an array from WMI Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2") Set colItems = objWMIService.ExecQuery _ ("SELECT * FROM Win32_LogicalDisk Where DriveType = 3") For Each objItem In colItems fldrx = objItem.DeviceID & "\Tools\" set fso = CreateObject("Scripting.FileSystemObject") if NOT fso.FolderExists(fldrx) Then fso.CreateFolder (fldrx) fldcx = True Exit For End If Exit For Next ' Grab the screen elements strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery _ ("Select * From Win32_DisplayConfiguration") ' Write the data to the tools directory For Each objItem In colItems fsa = "Name: " & objItem.DeviceName fsb = "Color depth: " & objItem.BitsPerPel fsc = "Horizontal resolution: " & objItem.PelsWidth fsd = "Vertical resolution: " & objItem.PelsHeight fsl = fldrx & "screenresolution.txt" set fso = CreateObject("Scripting.FileSystemObject") set f = fso.OpenTextFile(fsl, "8", True) f.WriteLine(fsa) f.WriteLine(fsb) f.WriteLine(fsc) f.WriteLine(fsd) f.Close() Next
Please follow and like us: