Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: WMI module: some preview vaporware

  1. #1
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    54
    Posts
    8,636
    Blog Entries
    2
    Rep Power
    10

    WMI module: some preview vaporware

    Ok, guy. I say here about "Stay tuned".
    So some preview is needed.

    We were experimenting about possibility to natively add [wiki=Windows_Management_Instrumentation]WMI[/wiki] to thinBasic using a dedicated module.
    Please find attached to this post what we was getting so far. WMI module contains just one function called WMI_GetData with the following syntax:
    [code=thinbasic]
    TWMI_GetData(sComputername, NameSpace, UserName, Password, sClassName [, sWhere [, sFields]]) AS STRING
    [/code]

    WMI_GetData function returns a string full of tokens separated by $CRLF that is the list of all properties found inside the specified WMI class.
    Unzip into a new directory under \thinBasic\SampleScripts\WMI\ and executed the test script. Experiment changing the class name and see.

    For a list of WMI classes, please have a look at http://msdn2.microsoft.com/en-us/library/aa394554.aspx Attention, it is a huge huge area so quite easy to get lost.

    Please test it and report any error or whatever you can think it can be useful to the development.

    Important
    • WMI module is experimenting
    • Many sub-informations are still not available
    • produced list contains informations not part of the actual data. Those info are visible in between { and }
    • WMI module is only informative, so it just read data
    • any help is appreciated



    ADDED note:


    CHANGED:
    • 2007.10.13: added namespace, username, password to function TWMI_GetData. Attached updated.


    Attached Files Attached Files
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  2. #2
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    64
    Posts
    3,869
    Rep Power
    401

    Re: WMI module: some preview vaporware

    Thanks Eros for this preview, it is a little over my head, but the example ran fine on the few tests I ran. I commented the current test and tried another by uncommenting and it seems to report back lots of information. So seems to work fine so far!
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  3. #3
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,083
    Blog Entries
    5
    Rep Power
    725

    Re: WMI module: some preview vaporware

    Thanks a lot Eros,

    this seems to be highly valuable tool to extract various info !
    VolumeDirty=0
    ... uff

    It is nice to be able to retrieve processor info without using assembly.
    Is WMI only for 2000/XP ?


    Thanks,
    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  4. #4
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    54
    Posts
    8,636
    Blog Entries
    2
    Rep Power
    10

    Re: WMI module: some preview vaporware

    No, it is also available for Win95 and Win98 but not in native way.

    See "ADDED note" in first post of this thread for info on where to download WMI for Win95/Win98 OSs.

    I've personally installed it under Win98 (emulated under VMWare).
    Seems no problem. During installation it takes 1 minute or so to collect data and create repository. But it can take mode depending on HW type. At the end of the instalaltion process you will have to restart you machine.
    After that, thinBasic script will start to give results.


    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  5. #5
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,083
    Blog Entries
    5
    Rep Power
    725

    Re: WMI module: some preview vaporware

    Great ,

    thanks for the info


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  6. #6
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    54
    Posts
    8,636
    Blog Entries
    2
    Rep Power
    10

    Re: WMI module: some preview vaporware

    Also remember that WMI works also on the lan, so just indicate the name of anohter computer in your lan and you will get remote info (if your authorization level permits)

    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  7. #7
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    54
    Posts
    8,636
    Blog Entries
    2
    Rep Power
    10

    Re: WMI module: some preview vaporware

    Last update of experimental WMI module before release in next preview.
    Module file and example has been updated in first post of this thread.
    _________________________________________________
    What have been changed. New syntax of TWMI_GetData is the following:
    [code=thinbasic]

    sBuffer = WMI_GetData(sComputername, "", "", "", sClassName [, sWhere [, sFields]])

    [/code]
    sWhere: can be used to add more selection in class names items
    sFields: can be used to insidate to return only few info items from the class.

    Some usage examples:
    [code=thinbasic]
    '---This will return only Name and Size of logical disk whose DevideID is called C:
    sBuffer = WMI_GetData(ComputerName, "", "", "", "CIM_LogicalDisk", "DeviceID = 'C:'", "Name, Size" )

    '---This will return only the command line of the startup command info
    sBuffer = WMI_GetData(ComputerName, "", "", "", "Win32_StartupCommand", "", "Command" )
    [/code]

    Note that even if you specify some specific field names, some additional info are returned by the engine. I'm investigating the reasons.
    See example included in zipped file.

    Regards
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  8. #8

    Re: WMI module: some preview vaporware

    Any way to pass credentials to authenticate with this if your current security level doesn't allow access? (like the WMIC.EXE command line WMI tool allows you to specify a /USER and /PASSWORD)?

    Thanks
    Matt

  9. #9
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    54
    Posts
    8,636
    Blog Entries
    2
    Rep Power
    10

    Re: WMI module: some preview vaporware

    I will check in the week-end what I can do on this.

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  10. #10
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    54
    Posts
    8,636
    Blog Entries
    2
    Rep Power
    10

    Re: WMI module: some preview vaporware

    Matt,

    see first post in this thread.
    I've updated attached example and module adding: NameSpace, UserName, Password. I've not tested it because I'm at home and I have no domain here but should work.

    New syntax of TWMI_GetData is the following:
    [code=thinbasic]

    sBuffer = WMI_GetData(sComputername, NameSpace, UserName, Password, sClassName [, sWhere [, sFields]])

    [/code]

    NameSpace: name of the namespace that provides support for the needed class
    UserName: better to specify it in the form "domain\user"
    Password: ok, password of the specified user

    Leave all those fields blank when connecting to local computer.

    Let me know.
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 25
    Last Post: 20-09-2007, 17:57

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •