systeminformation icon indicating copy to clipboard operation
systeminformation copied to clipboard

Windows graphics changes

Open shoustech opened this issue 1 year ago • 3 comments

Note:

I am not using the previously used variable ssections because I could not find a reliable way to map any of the displays to the values output. I can go back in and add pixelDepth and main with the value from the main display in ssections as the default for all the monitors.

Description

I am opening this pull request because after #853 was submitted I ended up looking at the commands being used to pull the information on windows and noticed that there was some room for improvement. I fixed an issue where in some situations the output would exclude displays. I have also added the fields displayId and productionYear which was previously only available on MacOS.

Notable changes

The number of displays is now based on the variable tsections. I then match the InstanceName property to the Instance name property in msections and isections. For dsections I am finding the correct display by matching tsections.InstanceName to dsections.PNPDeviceID

After all of the objects associated with the display have been found the app will then pull variables in this order: tsection dsection msection and finally isection

Since the output of dsection is the most complete I pulled what I could from that object first and then went down the list from there. If a variable was not pulled from dsection or the correlated object could not be found I would then fill in blank values or pull backup variables from the other objects.

Also:

  • Added the fields: displayId and productionYear

Examples

In this situation I am using a RDP connection to a different desktop

Existing module

    "displays": [
      {
        "vendor": "",
        "model": "",
        "deviceName": "\\\\.\\DISPLAY17",
        "main": true,
        "builtin": false,
        "connection": "DVI",
        "resolutionX": 2560,
        "resolutionY": 1440,
        "sizeX": 53,
        "sizeY": 30,
        "pixelDepth": 32,
        "currentResX": 2560,
        "currentResY": 1440,
        "positionX": 0,
        "positionY": 0,
        "currentRefreshRate": 84
      }
    ]

Modified module

    "displays": [
      {
        "vendor": "Dell Inc.",
        "deviceName": "Dell E2414H (Digital - DVI)",
        "model": "Dell E2414H",
        "productionYear": 2014,
        "serial": "VMT444ASU",
        "displayId": "DISPLAY\\DEL4091\\5&21dbb09b&0&UID24832_0",
        "main": "",
        "builtin": false,
        "connection": "DVI",
        "sizeX": 53,
        "sizeY": 30,
        "pixelDepth": 0,
        "resolutionX": 2560,
        "resolutionY": 1440,
        "currentResX": 2560,
        "currentResY": 1440,
        "positionX": 0,
        "positionY": 0,
        "currentRefreshRate": 0
      },
      {
        "vendor": "D E L",
        "deviceName": "DELL U719D",
        "model": "DELL U719D",
        "productionYear": 2018,
        "serial": "GLQW7R",
        "displayId": "DISPLAY\\DEL415F\\5&21dbb09b&0&UID24833_0",
        "main": "",
        "builtin": false,
        "connection": "HDMI",
        "sizeX": 60,
        "sizeY": 34,
        "pixelDepth": 0,
        "resolutionX": 0,
        "resolutionY": 0,
        "currentResX": 0,
        "currentResY": 0,
        "positionX": 0,
        "positionY": 0,
        "currentRefreshRate": 0
      },
      {
        "vendor": "L E X",
        "deviceName": "A409U",
        "model": "A409U",
        "productionYear": 2015,
        "serial": "16843009",
        "displayId": "DISPLAY\\LEX0000\\5&21dbb09b&0&UID24836_0",
        "main": "",
        "builtin": false,
        "connection": "DP",
        "sizeX": 128,
        "sizeY": 72,
        "pixelDepth": 0,
        "resolutionX": 0,
        "resolutionY": 0,
        "currentResX": 0,
        "currentResY": 0,
        "positionX": 0,
        "positionY": 0,
        "currentRefreshRate": 0
      },
      {
        "vendor": "H W",
        "deviceName": "H V41",
        "model": "H V41",
        "productionYear": 2014,
        "serial": "3CQ4113RS",
        "displayId": "DISPLAY\\HWP311F\\5&21dbb09b&0&UID24839_0",
        "main": "",
        "builtin": false,
        "connection": "DVI",
        "sizeX": 52,
        "sizeY": 29,
        "pixelDepth": 0,
        "resolutionX": 0,
        "resolutionY": 0,
        "currentResX": 0,
        "currentResY": 0,
        "positionX": 0,
        "positionY": 0,
        "currentRefreshRate": 0
      },
      {
        "vendor": "(Standard monitor types)", //Current display 17
        "deviceName": "Generic Non-PnP Monitor",
        "model": "Generic Non-PnP Monitor",
        "productionYear": 0,
        "displayId": "DISPLAY\\Default_Monitor\\1&31c5ecd4&0&UID256_0",
        "main": "",
        "builtin": true,
        "connection": "RDP",
        "sizeX": 0,
        "sizeY": 0,
        "pixelDepth": 0,
        "resolutionX": 0,
        "resolutionY": 0,
        "currentResX": 0,
        "currentResY": 0,
        "positionX": 0,
        "positionY": 0,
        "currentRefreshRate": 0
      }
    ]

Without RDP original code:

    "displays": [
      {
        "vendor": "Dell Inc.",
        "model": "Dell E2414H (Digital - DVI)",
        "deviceName": "\\\\.\\DISPLAY1",
        "main": false,
        "builtin": false,
        "connection": "DVI",
        "resolutionX": 2560,
        "resolutionY": 1440,
        "sizeX": 53,
        "sizeY": 30,
        "pixelDepth": "32",
        "currentResX": 2560,
        "currentResY": 1440,
        "positionX": -2560,
        "positionY": 740,
        "currentRefreshRate": 84
      },
      {
        "vendor": "",
        "model": "",
        "deviceName": "\\\\.\\DISPLAY2",
        "main": true,
        "builtin": false,
        "connection": "HDMI",
        "resolutionX": 3840,
        "resolutionY": 2160,
        "sizeX": 60,
        "sizeY": 34,
        "pixelDepth": "32",
        "currentResX": 3840,
        "currentResY": 2160,
        "positionX": 0,
        "positionY": 0,
        "currentRefreshRate": 84
      },
      {
        "vendor": "",
        "model": "",
        "deviceName": "\\\\.\\DISPLAY3",
        "main": false,
        "builtin": false,
        "connection": "DP",
        "resolutionX": 1920,
        "resolutionY": 1080,
        "sizeX": 128,
        "sizeY": 72,
        "pixelDepth": "32",
        "currentResX": 1920,
        "currentResY": 1080,
        "positionX": 7,
        "positionY": -1080,
        "currentRefreshRate": 84
      },
      {
        "vendor": "",
        "model": "",
        "deviceName": "\\\\.\\DISPLAY4",
        "main": false,
        "builtin": false,
        "connection": "DVI",
        "resolutionX": 1920,
        "resolutionY": 1080,
        "sizeX": 52,
        "sizeY": 29,
        "pixelDepth": "32",
        "currentResX": 1920,
        "currentResY": 1080,
        "positionX": 1927,
        "positionY": -1080,
        "currentRefreshRate": 84
      }
    ]

Without RDP modified code:

"displays": [
      {
        "vendor": "Dell Inc.",
        "deviceName": "Dell E2414H (Digital - DVI)",
        "model": "Dell E2414H",
        "productionYear": 2014,
        "serial": "VMT444ASU",
        "displayId": "DISPLAY\\DEL4091\\5&21dbb09b&0&UID24832_0",
        "main": "",
        "builtin": false,
        "connection": "DVI",
        "sizeX": 53,
        "sizeY": 30,
        "pixelDepth": 0,
        "resolutionX": 0,
        "resolutionY": 0,
        "currentResX": 0,
        "currentResY": 0,
        "positionX": 0,
        "positionY": 0,
        "currentRefreshRate": 0
      },
      {
        "vendor": "D E L",
        "deviceName": "DELL U719D",
        "model": "DELL U719D",
        "productionYear": 2018,
        "serial": "GLQW7R",
        "displayId": "DISPLAY\\DEL415F\\5&21dbb09b&0&UID24833_0",
        "main": "",
        "builtin": false,
        "connection": "HDMI",
        "sizeX": 60,
        "sizeY": 34,
        "pixelDepth": 0,
        "resolutionX": 0,
        "resolutionY": 0,
        "currentResX": 0,
        "currentResY": 0,
        "positionX": 0,
        "positionY": 0,
        "currentRefreshRate": 0
      },
      {
        "vendor": "L E X",
        "deviceName": "A409U",
        "model": "A409U",
        "productionYear": 2015,
        "serial": "16843009",
        "displayId": "DISPLAY\\LEX0000\\5&21dbb09b&0&UID24836_0",
        "main": "",
        "builtin": false,
        "connection": "DP",
        "sizeX": 128,
        "sizeY": 72,
        "pixelDepth": 0,
        "resolutionX": 0,
        "resolutionY": 0,
        "currentResX": 0,
        "currentResY": 0,
        "positionX": 0,
        "positionY": 0,
        "currentRefreshRate": 0
      },
      {
        "vendor": "H W",
        "deviceName": "H V41",
        "model": "H V41",
        "productionYear": 2014,
        "serial": "3CQ4113RS",
        "displayId": "DISPLAY\\HWP311F\\5&21dbb09b&0&UID24839_0",
        "main": "",
        "builtin": false,
        "connection": "DVI",
        "sizeX": 52,
        "sizeY": 29,
        "pixelDepth": 0,
        "resolutionX": 0,
        "resolutionY": 0,
        "currentResX": 0,
        "currentResY": 0,
        "positionX": 0,
        "positionY": 0,
        "currentRefreshRate": 0
      }
    ]

shoustech avatar Sep 19 '23 03:09 shoustech

@shoustech wow, thank you! I will check it the upcoming days and if is also works here on my side, I will crate a new release.

sebhildebrandt avatar Sep 20 '23 09:09 sebhildebrandt

I have been using this change on a few hundred PCs for about 3-4 months now and it has been working without issue. I am going to be updating my agent and will be updating my systeminformation dependency.

Would you like an updated pull request?

I also have code we are using outside of the module that would be good features if you wanted the pull requests.

  • Windows TPMs (I can possibly write a Ubuntu script if required)
  • Windows Bitlocker Status (Status by drive and Recovery passwords)
  • Windows Local Users (All users profiles on the PC)
  • Browser history (from chrome currently reading the History file with the NPM SQLite client. Good info but might not be a good fit due to the SQlite dependency and requires copying the History database to a temp directory due to chrome keeping a consistent lock on the DB)
  • Software installed (Windows, Ubuntu, OSX)

shoustech avatar Apr 24 '24 16:04 shoustech

@shoustech i am really interested in the code to find out if bitlocker is set up. i could not find it in your fork, where could i find the code?

Joniras avatar Jul 14 '24 07:07 Joniras