Results 1 to 9 of 9

Thread: WMI calls from Linux

  1. #1
    Join Date
    Feb 2006
    Location
    Kentucky
    Beans
    417

    WMI calls from Linux

    I was wondering if it is possible to make wmi calls to a Windows machine (2000, XP, 2003, etc.) from a Linux workstation. I would like to be able to do this with Python, Perl or Ruby if possible. I have done some searching and have come up empty so far.

    My goal in this is to be able to pull data (installed software, bios data, shares, etc.) from machines on my network and then store that data in a database. Then I can build a web based frontend to be able to view and search the data. I know that it is possible to do this from a windows machine but I would really like to be able to do it from Linux.

    Thank you for any help you can provide.
    Thanks,

    etank

  2. #2
    Join Date
    Feb 2006
    Location
    Kentucky
    Beans
    417

    Re: WMI calls from Linux

    bump
    Thanks,

    etank

  3. #3
    Join Date
    Jan 2006
    Beans
    961

    Re: WMI calls from Linux

    http://en.wikipedia.org/wiki/Windows...nstrumentation

    You might be able to get hold of it using DCOM/SOAP. There seems to be some ports of DCOM to other platforms out there.

    Or.. if you already know how to do this on Windows you can write a client running on Windows that does the calls for you then transmits the results to your Linux-computers.

    Or.. you could use SSH to transmit the result (from stdout):

    Code:
    lars@ibmr52:~$ ssh nostdal.org ls
    %backup%~
    BACKUP
    dina-backup-description.lisp
    dina-backup-description.lisp~
    getenv.lisp
    getenv.lisp~
    mounts
    notes.txt
    programming
    public_html
    reply.gif
    rmfasl
    symbolicweb-conf.lisp
    ..returns the result of running `ls' on `nostdal.org' (you'll find a ssh-server for Windows via cygwin).. .. i suppose there are many ways of doing this

  4. #4
    Join Date
    Jan 2007
    Beans
    12

    Re: WMI calls from Linux

    I believe wmi calls would require the Win32 python extensions, and those are Windows only.

  5. #5
    Join Date
    Feb 2006
    Location
    Kentucky
    Beans
    417

    Re: WMI calls from Linux

    That was what I was afraid of.
    Thanks,

    etank

  6. #6
    Join Date
    Apr 2007
    Beans
    1

    Re: WMI calls from Linux

    It's possible to do what you want.... You will have to search for a kind of WMI client for windows and for a command line tool to request WMI data using a XML based message.. I recommend you to use the following links to do this:


    - WMI Mapper for HP Systems Insight Manager at
    http://h18023.www1.hp.com/support/fi...oad/21071.html
    (It works for other machines, not only HP!)

    and

    - OpenPegasus at
    http://www.openpegasus.org/

    after installing OpenPegasus on the Linux machine you will have a command line tool called wbemexec. With this tool you will be able to send WMI requests for windows systems running the WMI Mapper...

    Good Luck....

  7. #7
    Join Date
    Aug 2007
    Location
    ooty
    Beans
    17
    Distro
    Xubuntu 8.10 Intrepid Ibex

    Re: WMI calls from Linux

    That sounds promising
    Thnx

  8. #8
    Join Date
    Oct 2006
    Location
    Lyon - France
    Beans
    3
    Distro
    Kubuntu 8.04 Hardy Heron

    Re: WMI calls from Linux

    sudo aptitude install wmi-client



    Example of usage is;

    wmic -U DOMAIN/administrator%password //10.99.92.9 "Select * from Win32_Service"

    Lists all services, the first line it spits back is the fields whihc you can use this SQL like langauge on to filter so to see only the names of the services installed we'd do:

    wmic -U DOMAIN/administrator%password //10.99.92.9 "Select Name from Win32_Service"

    Or Name and State:

    wmic -U DOMAIN/administrator%password //10.99.92.9 "Select Name,State from Win32_Service"

    Or for jsut one service in this case the UPS service:

    wmic -U DOMAIN/administrator%password //10.99.92.9 "Select Name,State from Win32_Service where name='UPS'"


    Hope this helps, this is only in Hardy as far as I'm aware.

    Félim

  9. #9
    Join Date
    Oct 2006
    Location
    Lyon - France
    Beans
    3
    Distro
    Kubuntu 8.04 Hardy Heron

    Re: WMI calls from Linux

    In fact the language that wmic client uses is like SQL because it's called WQL and a referance for it is here:

    http://msdn.microsoft.com/en-us/libr...06(VS.85).aspx

Bookmarks

Posting Permissions

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