Windows Scripting
  Home arrow Windows Scripting arrow Connecting to WMI with PHP
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WINDOWS SCRIPTING

Connecting to WMI with PHP
By: James Murray
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 23
    2004-07-06

    Table of Contents:
  • Connecting to WMI with PHP
  • The Newest SQL Slang
  • The Safe Command Line “format” Command
  • Spit it Out
  • Just a Few More Words

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Connecting to WMI with PHP


    (Page 1 of 5 )

    WMI (Windows Management Instrumentation) is a very powerful tool for anyone who runs their own server on a win32 platform. It can provide you with many pieces of information that you’d never thought possible. Beyond that you can even control almost every aspect of your system with WMI. Couple that with PHP and you’ll have the power to perform almost any type of action you’d like on your server.

    Getting Started

    WMI uses the Common Information Model, which is an industry standard to represent systems, applications, networks, devices, and other components. This means that you can have it show all kinds of useful information such as what programs are running, how much ram is being used, network activity, even how many hard drives are installed on your system. Almost every Windows system since Windows 2000 has WMI capabilities, and it can be downloaded for earlier systems from Microsoft’s website. All you have to do to turn it on is open a command prompt then execute the command “WMIC”. It will take a few minutes to start if you’ve never used WMI on your system before because it has to install all the services needed to run WMI.

    It would seem fairly simple to just run an exec() in PHP and retrieve whatever data you wanted to from the command line, but it’s not exactly that easy. The first thing to do is figure out exactly what information you want, and what you want to do with it. Then you’ll have to figure out the best way to make WMI format your information. And lastly you’ll have to get PHP to send the query to the WMI, retrieve the data, and output it in a way that will be organized and easy to understand. You’ll also want to do a little more research on WMI before you get started. I recommend the Microsoft Developer Network’s website on WMI, which can be found here http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_start_page.asp

    More Windows Scripting Articles
    More By James Murray


       · $xml[] = simplexml_load_string($results) - where's the semicolon...
     

    WINDOWS SCRIPTING ARTICLES

    - More Windows Scripting Workarounds from Nilpo
    - Overloading Methods and More in VBScript
    - Improving MFC for Windows Vista
    - Regular Expressions in VBScript
    - Working with Dates in WMI
    - Completing Calendars with VBScript Date Func...
    - Building Calendars with VBScript Date Functi...
    - Working With Dates and Times in VBScript
    - Designing WCF DataContract Classes Using the...
    - Understanding Dates and Times in VBScript
    - Working With Arrays in VBScript
    - Compressed Folders in WSH
    - Using .NET Interops in VBScript
    - Nilpo`s Scripting Secrets, Vol I
    - Database operations using Silverlight 2.0 WC...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek