Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
On Error Resume Next
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
arrComputers = Array(".")
For Each strComputer In arrComputers
WScript.Echo
WScript.Echo "=========================================="
WScript.Echo "Computer: " & strComputer
WScript.Echo "=========================================="
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_VideoSettings", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
WScript.Echo "Element: " & objItem.Element
WScript.Echo "Setting: " & objItem.Setting
WScript.Echo
Next
Next
yes, so i can see what resolutions are possible with my video controller but what i need is a a scipt which makes automatically the client into the highest possible resolution.
option explicit
on error resume next
Dim strComputer, colItems1, colItems2, objItem1, objItem2, objWMIService, objWMIService1
Dim objShare, objInParam, objOutParams, height, width
Dim strKeyPath, arrSubKeys, subkey, strKeyPath1, arrSubKeys1, subkey1
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objWMIService1 = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\DEFAULT")
Dim colItems : Set colItems = objWMIService.ExecQuery("Select * From CIM_VideoControllerResolution")
Dim maxHR : maxHR = 0
Dim maxVR : maxVR = 0
Dim objItem
For Each objItem in colItems
If objItem.HorizontalResolution > maxHR Then maxHR = objItem.HorizontalResolution
If objItem.VerticalResolution > maxVR Then maxVR = objItem.VerticalResolution
Next
height = maxVR
width = maxHR
Set objShare = objWMIService.Get("StdRegProv")
Set colItems1 = objWMIService1.ExecQuery( _
"SELECT * FROM Win32_DesktopMonitor",,48)
For Each objItem1 in colItems1
If Instr(objItem1.Name,"2407") Then
strKeyPath = "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Control\VIDEO"
objShare.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
strKeyPath1 = "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Control\VIDEO\" & subkey & "\0000"
objShare.EnumKey HKEY_LOCAL_MACHINE, strKeyPath1, arrSubKeys1
Set objInParam = objShare.Methods_("SetDWORDValue"). _
inParameters.SpawnInstance_()
objInParam.Properties_.Item("hDefKey") = &H80000002
objInParam.Properties_.Item("sSubKeyName") = "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Control\VIDEO\" & subkey & "\0000"
objInParam.Properties_.Item("sValueName") = "DefaultSettings.YResolution"
objInParam.Properties_.Item("uValue") = height
Set objOutParams = objWMIService.ExecMethod("StdRegProv", "SetDWORDValue", objInParam)
objInParam.Properties_.Item("sSubKeyName") = "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Control\VIDEO\" & subkey & "\0000"
objInParam.Properties_.Item("sValueName") = "DefaultSettings.XResolution"
objInParam.Properties_.Item("uValue") = width
Set objOutParams = objWMIService.ExecMethod("StdRegProv", "SetDWORDValue", objInParam)
For Each subkey1 In arrSubKeys1
' *** Setzen der DWORD Registrywerte für die DefaultAuflösung
Set objInParam = objShare.Methods_("SetDWORDValue"). _
inParameters.SpawnInstance_()
objInParam.Properties_.Item("hDefKey") = &H80000002
objInParam.Properties_.Item("sSubKeyName") = "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Control\VIDEO\" & subkey & "\0000\" & subkey1
objInParam.Properties_.Item("sValueName") = "DefaultSettings.YResolution"
objInParam.Properties_.Item("uValue") = height
Set objOutParams = objWMIService.ExecMethod("StdRegProv", "SetDWORDValue", objInParam)
objInParam.Properties_.Item("sSubKeyName") = "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Control\VIDEO\" & subkey & "\0000\" & subkey1
objInParam.Properties_.Item("sValueName") = "DefaultSettings.XResolution"
objInParam.Properties_.Item("uValue") = width
Set objOutParams = objWMIService.ExecMethod("StdRegProv", "SetDWORDValue", objInParam)
Next
Next
End If
Next
dm4ever said:My philosophy: K.I.S.S - Keep It Simple Stupid
Option Explicit
On Error Resume Next
Dim strComputer, colItems1, colItems2, objItem1, objItem2, objWMIService, objWMIService1
Dim objShare, objInParam, objOutParams, height, width
Dim strKeyPath, arrSubKeys, subkey, strKeyPath1, arrSubKeys1, subkey1
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objWMIService1 = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\DEFAULT")
Dim colItems : Set colItems = objWMIService1.ExecQuery("Select * From CIM_VideoControllerResolution")
Dim maxHR : maxHR = 0
Dim maxVR : maxVR = 0
Dim objItem
For Each objItem in colItems
If objItem.HorizontalResolution > maxHR Then maxHR = objItem.HorizontalResolution
If objItem.VerticalResolution > maxVR Then maxVR = objItem.VerticalResolution
Next
height = maxVR
width = maxHR
Set objShare = objWMIService.Get("StdRegProv")
Set colItems1 = objWMIService1.ExecQuery( _
"SELECT * FROM Win32_DesktopMonitor",,48)
For Each objItem1 in colItems1
strKeyPath = "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Control\VIDEO"
objShare.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
strKeyPath1 = "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Control\VIDEO\" & subkey & "\0000"
objShare.EnumKey HKEY_LOCAL_MACHINE, strKeyPath1, arrSubKeys1
Set objInParam = objShare.Methods_("SetDWORDValue"). _
inParameters.SpawnInstance_()
objInParam.Properties_.Item("hDefKey") = &H80000002
objInParam.Properties_.Item("sSubKeyName") = "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Control\VIDEO\" & subkey & "\0000"
objInParam.Properties_.Item("sValueName") = "DefaultSettings.YResolution"
objInParam.Properties_.Item("uValue") = height
Set objOutParams = objWMIService.ExecMethod("StdRegProv", "SetDWORDValue", objInParam)
objInParam.Properties_.Item("sSubKeyName") = "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Control\VIDEO\" & subkey & "\0000"
objInParam.Properties_.Item("sValueName") = "DefaultSettings.XResolution"
objInParam.Properties_.Item("uValue") = width
Set objOutParams = objWMIService.ExecMethod("StdRegProv", "SetDWORDValue", objInParam)
For Each subkey1 In arrSubKeys1
' *** Setzen der DWORD Registrywerte für die DefaultAuflösung
Set objInParam = objShare.Methods_("SetDWORDValue"). _
inParameters.SpawnInstance_()
objInParam.Properties_.Item("hDefKey") = &H80000002
objInParam.Properties_.Item("sSubKeyName") = "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Control\VIDEO\" & subkey & "\0000\" & subkey1
objInParam.Properties_.Item("sValueName") = "DefaultSettings.YResolution"
objInParam.Properties_.Item("uValue") = height
Set objOutParams = objWMIService.ExecMethod("StdRegProv", "SetDWORDValue", objInParam)
objInParam.Properties_.Item("sSubKeyName") = "SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Control\VIDEO\" & subkey & "\0000\" & subkey1
objInParam.Properties_.Item("sValueName") = "DefaultSettings.XResolution"
objInParam.Properties_.Item("uValue") = width
Set objOutParams = objWMIService.ExecMethod("StdRegProv", "SetDWORDValue", objInParam)
Next
Next
Next