Scripting SMS Operations

Like any system, using Microsoft® Systems Management Server (SMS) 2003 extensively often requires performing numerous tasks many times. Most SMS tasks are usually performed by using the SMS Administrator console. However, you can write simple scripts to perform almost any SMS task. These scripts can then be repeated frequently or extended to work with many sites at once. Or, the scripts can run from features such as Scheduled Tasks in Microsoft Windows® 2000. This removes the need for an SMS administrator to be available when the task is required. Such scripts can save a lot of manual effort and can even make some things possible that would not otherwise be possible.

Using your imagination, a reasonable understanding of SMS, and the scripting details presented in this appendix, you can manage SMS more efficiently and create solutions to better serve your organization's needs. This appendix includes many practical examples, but these examples are only a small fraction of the possible solutions.

You do not have to be a programmer to write scripts. Programming skills can help, but simple scripts can be fairly intuitive for anyone. Using sample scripts (provided in this appendix and elsewhere), you can often accomplish tasks with only minor changes to the sample scripts. As you become more comfortable with scripting, your scripts can become more sophisticated.

The following are possible situations in which scripting SMS operations is useful:

  • You have many sites in your SMS hierarchy and it is too tedious and error-prone to manually make changes to all the sites. It is also time-consuming to verify the settings on all sites.

  • You are frequently creating, modifying, or removing SMS objects such as collections, advertisements, packages, queries, site systems, or reports.

  • You have special needs when using SMS that are awkward or impossible for an SMS administrator to do with the SMS Administrator console or the available SMS tools.

  • You have a task that must be completed for some of your SMS administrators, but it requires privileges that you do not want to give to those administrators - and it would be inconvenient for administrators with privileges to do it for them. In this case, you can set up a scheduled task to routinely do the task while running with a privileged account.

Scripts also have the benefit of being compact and are therefore easy to transfer and edit. They can be used with scheduling services, alert systems, and similar systems that can invoke scripts. You can even use SMS to run the scripts that automate your SMS operations. When you have fully debugged your scripts, there is no risk of error. An administrator creating objects might type or select values incorrectly, but a fully debugged script does it correctly every time.

In This Appendix

  • Understanding Scripting

  • Getting SMS Objects

  • Working with SMS objects

  • Working with SMS Site Settings

  • Scripting Console Operations

  • Scripting Client Operations

  • Debugging Scripts

  • Using Scripts on Web Pages

  • Understanding Support Implications of Scripted Solutions

  • Learning More

For information about creating scripts that can be used with SMS software distribution, which is not discussed in this appendix, see Chapter 5, "Distributing Software," and Chapter 7, "Creating Software Installation Packages with SMS Installer." For information about the scripting of SMS site setup, which is also not discussed in this appendix, see Chapter 15, "Deploying and Configuring SMS Sites," in the MicrosoftSystems Management Server 2003 Concepts, Planning, and Deployment Guide.

For More Information

Did you find this information useful? Please send your suggestions and comments about the documentation to smsdocs@microsoft.com.