The Administrator Shortcut Guide to Vbscripting for Windows

The Administrator Shortcut Guide to Vbscripting for Windows

TheThe AdministratorAdministrator ShortcutShortcut GuideGuidetmtm TToo VBScripting for Windows Don Jones Introduction Introduction to Realtimepublishers by Don Jones, Series Editor For several years, now, Realtime has produced dozens and dozens of high-quality books that just happen to be delivered in electronic format—at no cost to you, the reader. We’ve made this unique publishing model work through the generous support and cooperation of our sponsors, who agree to bear each book’s production expenses for the benefit of our readers. Although we’ve always offered our publications to you for free, don’t think for a moment that quality is anything less than our top priority. My job is to make sure that our books are as good as—and in most cases better than—any printed book that would cost you $40 or more. Our electronic publishing model offers several advantages over printed books: You receive chapters literally as fast as our authors produce them (hence the “realtime” aspect of our model), and we can update chapters to reflect the latest changes in technology. I want to point out that our books are by no means paid advertisements or white papers. We’re an independent publishing company, and an important aspect of my job is to make sure that our authors are free to voice their expertise and opinions without reservation or restriction. We maintain complete editorial control of our publications, and I’m proud that we’ve produced so many quality books over the past years. I want to extend an invitation to visit us at http://nexus.realtimepublishers.com, especially if you’ve received this publication from a friend or colleague. We have a wide variety of additional books on a range of topics, and you’re sure to find something that’s of interest to you—and it won’t cost you a thing. We hope you’ll continue to come to Realtime for your educational needs far into the future. Until then, enjoy. Don Jones i Table of Contents Introduction to Realtimepublishers..................................................................................................i Chapter 1: Introduction to VBScript................................................................................................1 What is VBScript? ...........................................................................................................................1 Functions and Statements ................................................................................................................3 Exploring Functions.............................................................................................................3 Using Functions ...................................................................................................................5 Fancy Variables ...............................................................................................................................6 Adding Logic ...................................................................................................................................7 Choosing from a List of Possibilities...................................................................................8 Executing Code Again and Again and Again......................................................................9 Declaring Variables Carefully ...........................................................................................11 Alternative Loops...............................................................................................................12 Working with Objects....................................................................................................................13 The WScript Object .......................................................................................................................14 File and Folder Objects..................................................................................................................17 Your First Administrative Script ...................................................................................................21 Summary........................................................................................................................................23 Chapter 2: Working with ADSI .....................................................................................................24 ADSI Without a Directory.............................................................................................................24 ADSI Providers..............................................................................................................................27 The WinNT Provider .........................................................................................................27 The LDAP Provider ...........................................................................................................28 An ADSI Shortcut..........................................................................................................................30 Querying Global Catalog Servers ..................................................................................................32 Useful ADSI Scripts ......................................................................................................................33 User Account Scripts .........................................................................................................33 Group Scripts .....................................................................................................................35 Computer Account Scripts.................................................................................................36 Computer Management Scripts..........................................................................................37 Scripting Batch Operations............................................................................................................39 Summary........................................................................................................................................41 Chapter 3: Working with WMI......................................................................................................42 Classes and Queries .......................................................................................................................42 ii Table of Contents Scripting and WMI ........................................................................................................................46 There’s No One, Right Way ..............................................................................................48 Alternative Credentials ......................................................................................................49 Credential Security.............................................................................................................51 What to Do With WMI ..................................................................................................................51 WMI Scriptlets...............................................................................................................................54 Managing Services.............................................................................................................54 Archive Security Logs .......................................................................................................57 Extended WMI...................................................................................................................59 Summary........................................................................................................................................61 Chapter 4: Advanced Scripting......................................................................................................62 Remote Scripting ...........................................................................................................................62 The WshController Object.................................................................................................63 WScript.ConnectObject .....................................................................................................64 Remote Scripting Limitations............................................................................................65 Database Scripting .........................................................................................................................66 Making Data Connections..................................................................................................66 Querying and Displaying Data...........................................................................................68 Modifying Data..................................................................................................................72 Windows Script Files.....................................................................................................................75 Signing Scripts...............................................................................................................................77 Summary........................................................................................................................................78 iii Copyright Statement Copyright Statement © 2005 Realtimepublishers.com, Inc. All rights reserved. This site contains materials that have been created, developed, or commissioned by, and published with the permission of, Realtimepublishers.com, Inc. (the

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    83 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us