VBScript, WMI, and ADSI Unleashed: Using VBScript, WMI, and ADSI to Automate Windows® Administration

Book description

If you’re a Windows administrator, scripting expertise can liberate you from boring, repetitive work–so you can take on the sophisticated, high-value projects you really want. Top scripting guru Don Jones has written the definitive administrator’s guide to getting results with Microsoft’s key scripting technologies: VBScript, WMI, and ADSI.

Jones draws on his unsurpassed experience training Windows administrators in conferences, classes, and from his enormously popular site, ScriptingAnswers.com.

You’ll learn how to use VBScript, WMI, and ADSI to gain administrative control over nearly every aspect of every recent Windows server or client, including Windows Server 2003, Vista, XP, 2000, and NT. As you gain experience, Jones introduces more advanced techniques, ranging from modular scripting and script encryption to integrating VBScript with HTML code.

Jones concludes with a full section of ready-to-run, real-world examples–from logon/logoff scripts to automated domain and network administration, from querying WMI to creating Active Directory groups. Every script is explained line-by-line, with challenging techniques described in even greater detail.

Detailed information on how to…

  • Decide what you can script: a framework for getting started fast

  • Understand how scripts are designed, assembled, and run

  • Master VBScript from start to finish: functions, I/O, data manipulation, program flow, and much more

  • Use scripting objects for tasks ranging from retrieving network information to mapping drives

  • Utilize FileSystemObject to manipulate the Windows filesystem

  • Write ADSI scripts to manipulate any directory service your company uses, from Active Directory to Novell NDS

  • Modify domain information, users, groups, and policies

  • Query WMI information–from basic to advanced

  • Plan for errors, and test and debug your scripts

  • Build your own “resource kit” of reusable script components


    Download all examples and source code presented in this book from ScriptingAnswers.com, where you’ll also be able to post follow-up questions directly to the author in a moderated, active community.

    Introduction 1

    Part I: Introduction to Windows Administrative Scripting 11

    Chapter 1: Scripting Concepts and Terminology 13

    Chapter 2: Running Scripts 21

    Chapter 3: The Components of a Script 39

    Chapter 4: Designing a Script 55

    Part II: VBScript Tutorial 73

    Chapter 5: Functions, Objects, Variables, and More 75

    Chapter 6: Input and Output 101

    Chapter 7: Manipulating Numbers 115

    Chapter 8: Manipulating Strings 129

    Chapter 9: Manipulating Other Types of Data 145

    Chapter 10: Controlling the Flow of Execution 155

    Chapter 11: Built-In Scripting Objects 173

    Chapter 12: Working with the File System 193

    Chapter 13: Putting It All Together: Creating Your First Script from Scratch 219

    Part III: Windows Management Instrumentation and Active Directory Services Interface 245

    Chapter 14: Working with ADSI Providers 247

    Chapter 15: Manipulating Domains 257

    Chapter 16: Manipulating Users and Groups 271

    Chapter 17: Understanding WMI 283

    Chapter 18: Querying Basic WMI Information 299

    Chapter 19: Querying Complex WMI Information 317

    Chapter 20: Putting It All Together: Your First WMI/ADSI Script 335

    Chapter 21: Testing and Debugging WMI and ADSI Queries 357

    Part IV: Advanced Scripting Techniques 371

    Chapter 22: Modular Script Programming 373

    Chapter 23: Scripts Packaging and Protection 389

    Chapter 24: Scripting Security 399

    Chapter 25: Introduction to HTML Applications 409

    Chapter 26: Debugging Tips, Tools, and Techniques 421

    Part V: Ready-to-Run Examples 437

    Chapter 27: Logon and Logoff Scripts 439

    Chapter 28: Windows and Domain Administration Scripts 455

    Chapter 29: Network Administration Scripts 481

    Chapter 30: WMI and ADSI Scripts 497

    Appendix 509

    Index 523


    Product information

    • Title: VBScript, WMI, and ADSI Unleashed: Using VBScript, WMI, and ADSI to Automate Windows® Administration
    • Author(s): Don Jones
    • Release date: May 2007
    • Publisher(s): Sams
    • ISBN: 9780321501714