I updated the code above, there was an error. Here is another example based on your vbscript.

? screenreswidth()
? screenresheight()
;? screenreswidth("RemoteComputerName") 
 

Function ScreenResWidth(optional $remotecomputer) dim $objwmiservice, $colitems, $objitem if $remotecomputer="" $strComputer = "." endif $objWMIService = GetObject("winmgmts:\\" + $strComputer + "\root\cimv2") if $objwmiservice $colItems = $objWMIService.ExecQuery("Select * From Win32_DesktopMonitor where DeviceID = 'DesktopMonitor1'",,0) For Each $objItem in $colItems $ScreenResWidth = $objItem.ScreenWidth Next endif endfunction
Function ScreenResHeight(optional $remotecomputer) dim $objwmiservice, $colitems, $objitem if $remotecomputer="" $strComputer = "." endif $objWMIService = GetObject("winmgmts:\\" + $strComputer + "\root\cimv2") if $objwmiservice $colItems = $objWMIService.ExecQuery("Select * From Win32_DesktopMonitor where DeviceID = 'DesktopMonitor1'",,0) For Each $objItem in $colItems $ScreenResHeight = $objItem.ScreenHeight Next endif endfunction