BrainDump
  Home arrow BrainDump arrow Page 5 - Microsoft`s Strategy to Centralize and Man...
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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
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? 
BRAINDUMP

Microsoft`s Strategy to Centralize and Manage Automated Installations: SMS 2003
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 5
    2006-05-01

    Table of Contents:
  • Microsoft`s Strategy to Centralize and Manage Automated Installations: SMS 2003
  • Efficiency of SMS Server
  • Definitions: an SMS Site, Site Client, Site Server, Site System
  • Can we connect and develop desktop applications using SMS?
  • A sample WMI script to connect and retrieve SMS information
  • Another Feature Pack from Microsoft to ease SMS deployments

  • 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


    Microsoft`s Strategy to Centralize and Manage Automated Installations: SMS 2003 - A sample WMI script to connect and retrieve SMS information


    (Page 5 of 6 )

    As this is an introductory article, I simply wanted to demonstrate how you connect and retrieve SMS information using VBScript together with WMI.

        Set locator = CreateObject("WbemScripting.SWbemLocator")
        Set smsserver = locator.ConnectServer("servername", "rootsms")
        Set info = smsserver.ExecQuery("SELECT * From SMS_ProviderLocation")
            For each i in info
                   sitecode = i.SiteCode
                   Wscript.Echo sitecode
            Next
        Set smsserver = Nothing

    The above would simply list all the sms site codes.  Let me explain the code part by part.  I hope by now you can already understand the first two statements.  The third statement is as follows:

        Set info = smsserver.ExecQuery("SELECT * From SMS_ProviderLocation")

    The above code uses WQL (WMI Query Language).  The serverobject (smsserver) supports a method "ExecQuery" to execute any SELECT statement (conforming to the semantics of WMI Query Language) which can return a handful of information (either in the form of a table or objects or properties). Once we receive information, we need to go through all those objects and display them on the screen.  The following code fragment does the same.

            For each i in info
                   sitecode = i.SiteCode
                   Wscript.Echo sitecode
            Next

    It is always a good practice to release memory resources, once we complete our work.  That means the connection to the SMS server that we established in the beginning is no longer necessary.  The following statement would release all such memory resources:

        Set smsserver = Nothing

    Let us extend the above a bit.  The beauty of the above code is that we can directly use it in ASP for web development as follows:

    <html>
    <body>
    <%
    Set locator = CreateObject("WbemScripting.SWbemLocator")     Set smsserver = locator.ConnectServer("servername", "rootsms")     Set info = smsserver.ExecQuery("SELECT * From SMS_ProviderLocation")         For each i in info                sitecode = i.SiteCode                <%= sitecode %>        Next     Set smsserver = Nothing %> </body> </html>

    It is that easy.  You can simply imagine that any VBScript script can be converted to ASP with a very few basics.

    More BrainDump Articles
    More By Jagadish Chaterjee


       · Hai, I am introducing Microsoft SMS in this article. The coming-up may introduce...
     

    BRAINDUMP ARTICLES

    - Internet Explorer 8 Review
    - Nilpo`s Top Windows Add-Ons
    - Beginning Silverlight 2.0 Development using ...
    - Fixing Vista`s Troubles
    - Preparing Windows Images for Mass Deployment
    - The Trouble With Vista
    - Slipstreamed and Unattended Windows Installa...
    - Microsoft Office SharePoint Server
    - Microsoft Office SharePoint Designer
    - Microsoft Windows SharePoint Services 3.0
    - Microsoft Live Mesh Overview
    - XAML Brushes and Silverlight
    - Silverlight and XAML Basics
    - Immortal XP
    - XAML Basics





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
    Stay green...Green IT