Multi-OEM/Retail Project {MRP} - Mk3

Discussion in 'MDL Projects and Applications' started by mxman2k, Oct 15, 2016.

  1. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,360
    7,081
    210
    CompatTelRunner task? More notes concerning the Win11 checks in general.
     
  2. mxman2k

    mxman2k MDL Developer

    Jun 20, 2007
    5,804
    19,407
    180
    #9562 mxman2k, Feb 14, 2023
    Last edited: Feb 14, 2023
    (OP)
    Yep, it a bit awkward to get the task stuff in AutoIT -- unlike it is easier in cmd/ps...

    So i have done a couple of checks, one for task of it and the other if the file exists.

    It may be only one part of the w11 checking but it the main one that sends that info back to m$ that the device is all green for w11 or if not why...

    The GUI QT is slowly being enhanced, it will eventually replace the old cmd run version which then be left as a legacy version on its own download area. :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,360
    7,081
    210
    The old version is still required for Vista/Server 2008 SP2.
     
  4. mxman2k

    mxman2k MDL Developer

    Jun 20, 2007
    5,804
    19,407
    180
    Exactly why the old one is being put as a legacy download when the time comes. :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. mxman2k

    mxman2k MDL Developer

    Jun 20, 2007
    5,804
    19,407
    180
    #9565 mxman2k, Feb 15, 2023
    Last edited: Feb 15, 2023
    (OP)
    Something added to GUI QT in the Graphics tab, but may need extra work when more than one monitor detected.

    As i not have more than 1 connected i am not 100% sure it will just use the first monitor data...

    Code:
    First Monitor Name/Model        : S241HL
    First Monitor Serial Number     : xxxxE0218549
    Just getting that info was a major challenge as you have to decode the info from any EDID in the registry!

    Postable/GUI obfuscates the Serial number, Private log shows in full.

    Hmm needs a bit of work when the default monitor has no EDID :(

    But can work around that just be no serial number, i can hopefully get Name and Model....
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. mxman2k

    mxman2k MDL Developer

    Jun 20, 2007
    5,804
    19,407
    180
    Managed to hopefully get the manufacturer, model/type and devicepnpid if it available to read. Some monitors/tv's may just say Generic etc.

    Taking a Tv break now so will resume tomorrow morning.

    Have gui part almost sorted, just got to sort out the saved log part.

    If all gone to plan if more than one monitor connected the qt should show the data, limited to 4 monitor entries as no other space in that tab section.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. mxman2k

    mxman2k MDL Developer

    Jun 20, 2007
    5,804
    19,407
    180
    Hopefully this routine now works even with more than one display attached...

    Graphics section results from my main PC (one display):
    Code:
    ===================================================================================================================
                                              Graphics Information                                                    
    ===================================================================================================================
    Adaptor Name                    : NVIDIA GeForce GTX 1050 Ti
    Adaptor DACType                 : Integrated RAMDAC {Addon}
    Adaptor Driver Information      : 31.0.15.2756 {2022/12/05}
    Adaptor Status                  : Active
    
    Adaptor Name                    : Not Detected
    Adaptor DACType                 : N/A
    Adaptor Driver Information      : N/A
    Adaptor Status                  : Inactive
    
    Virtual Desktop Resolution      : 1920 x 1080
    Bits Per Pixel                  : 32
    Video Mode Description          : 1920 x 1080 x 4294967296 colors {Ref:1}
    
    Monitor/Display Information     : {Maximum of four shown}
    
    ========== Desktop Monitor 1 ==========
    Manufacturer : ACER
    Model/Type   : S241HL
    PNPDeviceID  : DISPLAY\ACR0312\5&FD8CBA9&0&UID4353
    
    Some values may not be accurate due to 32 bit API limitations.
    Monitor data may not always be accurate due to no information available.
    There is quite a bit of error checking done in this code section but as always some errors 'may' slip through, if nothing can be obtained then 'Generic' etc may be shown instead.

    On some TV's used as monitors the Extended ID was not always present and so confused the EID routine i used originally, so have used a more relaxed WMI method, it won't show the 'Serial Number' now but then that should be on a sticker on the display or via its settings/options button/menu anyway. The EID method can obtain more data but it gets a bit too complex to decode it all so this WMI method is simpler and should technically work on all displays if the info is in the registry etc.

    Have limited it to showing a max of four displays as there is no room in the GUI section unless i remove the PNPDeviceID lines to squeeze another 1 or 2 in, there again is it worth it?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. mxman2k

    mxman2k MDL Developer

    Jun 20, 2007
    5,804
    19,407
    180
    On another PC with a JVC TV used as a monitor:

    Code:
    ===================================================================================================================
                                              Graphics Information                                                   
    ===================================================================================================================
    Adaptor Name                    : AMD Radeon HD 6570
    Adaptor DACType                 : Internal {iGPU}
    Adaptor Driver Information      : 15.301.1901.0 {2016/02/26}
    Adaptor Status                  : Active
    
    Adaptor Name                    : Not Detected
    Adaptor DACType                 : N/A
    Adaptor Driver Information      : N/A
    Adaptor Status                  : Inactive
    
    Virtual Desktop Resolution      : 1400 x 1050
    Bits Per Pixel                  : 32
    Video Mode Description          : 1400 x 1050 x 4294967296 colors {Ref:1}
    
    Monitor/Display Information     : {Maximum of four shown}
    
    ========== Desktop Monitor 1 ==========
    Manufacturer : (Standard monitor types)
    Model/Type   : Generic Non-PnP Monitor
    PNPDeviceID  : DISPLAY\DEFAULT_MONITOR\5&5FF5EA&0&UID512
    
    Some values may not be accurate due to 32 bit API limitations.
    Monitor data may not always be accurate due to no information available.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. mxman2k

    mxman2k MDL Developer

    Jun 20, 2007
    5,804
    19,407
    180
    I have noticed on Win 11's Notepad replacement 'App' that some linefeeds 'CRLF' are ignored and so the text looks a bit squashed? But viewing the text/log file in this case on W10 using the original Notepad all looks ok!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. mxman2k

    mxman2k MDL Developer

    Jun 20, 2007
    5,804
    19,407
    180
    #9570 mxman2k, Feb 16, 2023
    Last edited: Feb 16, 2023
    (OP)
    Have uploaded this GUI QT to the private beta test area and will probably not be released for a while until i can make sure the multi-display part works, or it may only just show the main monitor in use at the time of the QT being run...

    It seems can only retrieve the first monitor :g:

    PShell goes nuts if an array is empty or some silly cryptic error that only the dev who wrote the OS code in PS would know :D

    The non ps code is set up to look for multiple monitors but wmi only shows primary one?

    May have to think more about that section, i can sort of get more info using p/shell but if certain results are nul then it throws its dummy out with silly red lettered cryptic crap...

    Plus ps is painfully slow...
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. mxman2k

    mxman2k MDL Developer

    Jun 20, 2007
    5,804
    19,407
    180
    At the moment i cant get a reliable method to find more than one display as the 'Win32_DesktopMonitor' does not seem to show more than one display?

    It has potential to show more but using a laptop with its main lcd and a HDMI tv/monitor connected it only shows/detects the Primary laptop one as found using Win32_DesktopMonitor wmi api.

    Until i can find a better method that will work on all supported OS's it may just show the Primary monitor data for the time being, I have adjusted the 'Notes' section in the Graphics tab and saved logs.

    For example:
    ---------------------------------------------
    Some values may not be accurate due to 32 bit API limitations.
    Monitor/Display section is experimental and will be updated later.
    Monitor data may only show the 'Primary' display.
    The name 'Generic' may be used when using some TV's etc.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. mxman2k

    mxman2k MDL Developer

    Jun 20, 2007
    5,804
    19,407
    180
    This looked promising...
    Until i tried it on Win 7 and WimiMonitorID is not present :(

    Code:
    strComputer = "."
    
    'Get monitors with WMI
    Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\WMI")
    Set colMonitors = objWMIService.ExecQuery("SELECT * FROM WmiMonitorID")
    
    For Each objMonitor in colMonitors
    
      'Convert model name to ASCII
      ProductId = ""
      For I = 0 To Ubound(objMonitor.UserFriendlyName)
        ProductId = ProductId & Chr(objMonitor.UserFriendlyName(I))
      Next
    
      Wscript.echo ProductId
    Next
    I wrote a PShell script that is more advanced and that too not work on 7 or below because it makes extensive use of the WmiMonitorID class and gives more data...

    Took a while to 'sort of' understand PShell Arrays and how to use as a hashtable to convert 3 chars to the manufacturer name, i may not of got all the manufacturer 'codes' and those i missed will hopefully just show the abbreviated result or Generic instead.

    Model/Type should hopefully show ok too or Generic depending if a null result.

    I may add in the pshell version but that will only work on w8.1 -- (I think as cant find any info of minimum OS) -- and above and i will use the current single display code for below 8.x -- at least something will work on the older OS, may still not be perfect but better than nothing.

    If the above vbscript not work on 8.x then the PS one wont either...

    With the PS code i get:

    True|Acer|S241HL|2|2017|DISPLAY\ACR0312\5&fd8cba9&0&UID4353_0

    which from the above test of my PC using the script translates to:

    True = Display Active (or connected)
    Acer = Maker/Manufacturer (ACR would show if hashtable failed)
    S241HL = Model/Type (or Generic if no data)
    2 = Week of Manufacture
    2017 = Year of manufacturer
    DISPLAY\ACR.... = The DevicePNPID.

    I can get the Monitor serial numbers and a few other things but i just settled on the main bits.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. mxman2k

    mxman2k MDL Developer

    Jun 20, 2007
    5,804
    19,407
    180
    Hmm now the ps one not work on w11 :g: wtf is wrong with m$ they cant make anything easy or standard. :(

    Just like with the VideoRAM issue with greater than 4GB all over again...

    Will leave the display/monitor data as it is for now, spent enough time on it to get no where. :(
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. mxman2k

    mxman2k MDL Developer

    Jun 20, 2007
    5,804
    19,407
    180
    It does get very frustrating as using WbemTest.exe (in the win 11 OS) and checking for WmiMonitorID it finds it!!

    To test it:

    Open wbemtest (Start > Run > wbemtest).

    2. Click on the "Connect" button.

    3. Enter root\wmi in the "Namespace" field and click on the "Connect" button.

    4. Click on the "Open Class" button.

    5. Enter WmiMonitorID in the "Enter Target Class Name:" field and click on the "OK" button.

    And it shows as there!! ???

    Dont edit anything in there or you could screw up your OS!! Just Close/exit.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  15. Dubioza Kolektiv

    Dubioza Kolektiv MDL Addicted

    Dec 27, 2012
    867
    1,463
    30
  16. mxman2k

    mxman2k MDL Developer

    Jun 20, 2007
    5,804
    19,407
    180
    Some progress that even works on win 11 - not tried 7/8.x yet but should 'technically' work as just using the WMI Win32_DesktopMonitor which appears to work from Vista and above - or so say m$!!

    When a monitor driver is installed via OS/WU/Manually and detected then the GUI QT will scan the driver hashtable for a Manufacturer if possible. Or 'Unknown' or 'Default' will be used.

    A Laptop:
    Code:
    ========== Desktop Monitor 1 ==========
    Manufacturer : AUO Corporation
    Model/Type   : Generic PnP Monitor
    PNPDeviceID  : DISPLAY\AUO47EC\4&3B56634&0&UID265988
    When no detectable monitor name or no driver installed for it via OS/WU or manually installed.

    PC on win11:
    Code:
    ========== Desktop Monitor 1 ==========
    Manufacturer : Generic as no monitor driver installed
    Model/Type   : Generic Non-PnP Monitor
    PNPDeviceID  : DISPLAY\DEFAULT_MONITOR\5&5FF5EA&0&UID512
    The above are only examples as it can vary on the hardware etc...

    But at least the main Monitor is shown if none of the others that may be connected.

    Uploaded for private testing as need to find out if it actually works and if i need to adjust the hashtable for Manufacturers etc...
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  17. mxman2k

    mxman2k MDL Developer

    Jun 20, 2007
    5,804
    19,407
    180
    Time for a TV break, been working on this since 5:15am :eek:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  18. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    16,230
    84,936
    340
    WmiMonitorID class was added since Windows Vista, but apparently it does not work for all machines or depend on monitor type
    specially VMs, it gives 0x8004100c Not supported, even for Windows 10

    when it work, it also works in PS 2.0 too (Win7)

    Win8.1
    Code:
    C:\Windows\system32>WMIC /NAMESPACE:\\root\WMI PATH WmiMonitorID get /value
    
    
    Active=TRUE
    InstanceName=DISPLAY\BOE0671\4&1ef9fde4&0&UID265988_0
    ManufacturerName={66,79,69,0,0,0,0,0,0,0,0,0,0,0,0,0}
    ProductCodeID={48,54,55,49,0,0,0,0,0,0,0,0,0,0,0,0}
    SerialNumberID={48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
    UserFriendlyName=
    UserFriendlyNameLength=0
    WeekOfManufacture=1
    YearOfManufacture=2016
     
  19. mxman2k

    mxman2k MDL Developer

    Jun 20, 2007
    5,804
    19,407
    180
    I read it was in vista and above after much searching on the net but, as you mentioned it comes up with not supported which threw me off as i could see the wmi entry in the classname but it refused to use it.

    Seems as it hit and miss on hardware at least what i have in the gui qt at the moment shows first monitor connected and some data.

    Will see how testing goes if it gets too much i will have to pull it from the qt. :(
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...