Managing Windows with VBScript and WMI (Paperback)

Don Jones

  • 出版商: Addison Wesley
  • 出版日期: 2004-04-03
  • 售價: $2,460
  • 貴賓價: 9.5$2,337
  • 語言: 英文
  • 頁數: 640
  • 裝訂: Paperback
  • ISBN: 0321213343
  • ISBN-13: 9780321213341
  • 已絕版

買這商品的人也買了...

商品描述

Table of Contents:

Preface.
Acknowledgments.
About the Author.

I. INTRODUCTION TO WINDOWS ADMINISTRATIVE SCRIPTING.

1. Scripting Concepts and Terminology.

What Is Scripting?

Script Hosts.

ActiveX Scripting Languages.

The Component Object Model (COM).

Critical Scripting Security Issues.

Review.

2. Running Scripts.

Windows Script Host.

Command-Line Scripts.

Notepad and Script Editors.

Bare Bones: Notepad.

A Step Up: Programmer's File Editor.

Script-Specific: VBScript Editors.

Writing Your First Script.

Running Your First Script.

Debugging Your First Script.

Review.

3. The Components of a Script.
     A Typical VBScript.

Functions.

Subroutines.

Main Script.

Using Custom Functions and Subroutines.

Using Intrinsic Functions and Statements.

Making Decisions in a Script.

Comments and Documentation.

Review.

4. Designing a Script.

Creating a Task List.

Selecting the Appropriate Tools.

Displaying a Message.

Mapping a Drive.

Checking Group Membership.

Mapping a Printer.

Getting the Local IP Address.

Getting the Third Octet from the IP Address.

All Tasks Accounted For.

Creating Modules to Perform Tasks.

Validating User Input.

Planning for Errors.

Creating Script Libraries.

Review.

II. VBSCRIPT TUTORIAL.

5. Functions, Objects, Variables, and More.

What Are Variables?

Declaring Variables.

Understanding Data Types.

Assigning Data to Variables.

Data Coercion.

What Are Functions?

Input Parameters.

Output Values.

Intrinsic versus Custom Functions.

What Are Statements and Subroutines?

Functions, without the Output.

What Are Objects?

Properties.

Methods.

Collections.

A Sample Object.

Scripting with Objects.

Review.

6. Input and Output.

Displaying Messages.

The MsgBox Statement and Function.

More Complex Messages.

MsgBox Best Practices.

Go Generic with WScript.Echo.

Asking for Input.

Graphical Input.

Command-Line Input.

Command-Line Parameters as Input.

Running Command-Line Scripts.

Parsing Parameters.

Review.

7. Manipulating Numbers.

Numbers in VBScript.

Basic Arithmetic.

Advanced Arithmetic.

Boolean Math.

Converting Numeric Data Types.

Converting Other Data Types to Numeric Data.

Review.

8. Manipulating Strings.

Strings in VBScript.

Working with Substrings.

Concatenating Strings.

Changing Strings.

Formatting Strings.

Converting Other Data Types to String Data.

Review.

9. Manipulating Other Types of Data.

Working with Dates and Times.

Dates and Times in VBScript.

Getting the Date or Time.

Converting Date and Time Data.

Working with Past and Future Dates.

Working with Arrays.

Arrays in VBScript.

Creating and Manipulating Arrays.

Working with Array Data.

Working with Bytes.

Bytes in VBScript.

Converting Byte Data.

Review.

10. Controlling the Flow of Execution.

Conditional Execution.

If…Then.

Select…Case.

Loops.

Do While…Loop and Do…Loop While.

Do Until…Loop and Do…Loop Until.

For…Next.

For Each…Next.

Exiting Loops.

Putting It All Together.

Review.

11. Built-in Scripting Objects.

The WScript Object.

The Network Object.

Overview.

Methods and Properties.

Practical Application.

The Shell Object.

Overview.

Methods and Properties.

The Shortcut Object.

Methods and Properties.

Practical Application.

Review.

12. Working with the File System.

The FileSystemObject Library.

Working with Drives.

Working with Drive Objects.

Working with Folders.

Working with Folder Objects.

Folder Attributes.

Properties That Are Objects.

Working with Files.

Working with File Objects.

Reading and Writing Text Files.

Other FSO Methods and Properties.

Creating a Log File Scanner.

Review.

13. Putting It All Together: Your First Script.

Designing the Script.

Gathering Facts.

Defining Tasks.

Outlining the Script.

Writing Functions and Subroutines.

Identifying Candidate Modules.

Writing the Filename Formatting Function.

Writing the Main Script.

Identifying Potential Errors.

Testing the Script.

Analyzing the Results.

Adding Debug Code.

Modifying the Script.

Completing the Script.

Review.

III. WINDOWS MANAGEMENT INSTRUMENTATION AND ACTIVE DIRECTORY SERVICES INTERFACE.

14. Working with ADSI Providers.

Using ADSI Objects.

Using the WinNT Provider.

Examples.

Using the LDAP Provider.

Other Providers.

Review.

15. Manipulating Domains.

Querying Domain Information.

Changing Domain Settings.

Working with OUs.

Creating an OU.

Modifying an OU.

Querying an OU.

Deleting an OU.

Putting It All Together.

Review.

16. Manipulating Users and Groups.

Creating Users and Groups.

The WinNT Way.

The LDAP Way.

Querying User Information.

Changing User Settings.

Working with Groups.

Putting It All Together.

Review.

17. Understanding WMI.

The WMI Hierarchy.

Providers and Consumers.

WMI Versions.

Exploring WMI's Capabilities.

WQL Queries.

Installing WMI.

Using the WMI Tools.

Scriptomatic.

Really—It's This Easy.

Find the Class.

Write the Query, Test the Query.

Write the Script.

Try the Script.

Review.

18. Querying Basic WMI Information.

The WMI Query Language (WQL).

The Basics.

Boolean Operators.

Comparison Operators.

Associators, References, and Keys.

Determining What to Query.

Testing the Query.

Writing the Query in VBScript.

Using the Query Results.

Alternative Methods.

Review.

19. Querying Complex WMI Information.

Understanding WMI Relationships.

Associating WMI Instances.

ASSOCIATORS OF.

REFERENCES OF.

Using WHERE with ASSOCIATIONS OF and REFERENCES OF.

Writing the Query.

Testing the Query.

Writing the Query in VBScript.

Another Example.

Review.

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

Designing the Script.

Writing Functions and Subroutines.

Writing the Main Script.

Testing the Script.

Review.

IV. CREATING ADMINISTRATIVE WEB PAGES.

21. Active Server Pages Crash Course.

About ASP.

VBScript in ASP.

The Response Object.

Writing Output.

Saving Cookies.

Ending.

The Request Object.

HTML Forms.

Cookies.

A Sample ASP Script.

Testing ASP Scripts.

Review.

22. Adding Administrative Script to a Web Page.

The Basic Web Page.

Adding Functions and Subroutines.

Adding Inline Script.

The Result.

Review.

23. Web Page Security Overview.

The ASP Security Context.

Prohibited Behaviors.

IIS 4.0, 5.0, and 5.1 versus IIS 6.0.

NTFS and IIS Security.

Writing Secure ASP Code.

Review.

24. Putting It All Together: Your First Administrative Web Pages.

Checking User Account Status.

Designing the Page.

Writing Functions and Subroutines.

Writing the Main Script.

Testing the Page.

Administering IIS.

Designing the Page.

Writing Functions and Subroutines.

Writing the Main Script.

Review.

V. ADVANCED SCRIPTING TECHNIQUES.

25. Modular Script Programming.

Introduction to Windows Script Components.

Scripting and XML.

Review.

26. Using Script Components.

Obtaining the Component.

Reviewing the Component.

Using the Component.

Review.

27. Encoded Scripts.

Installing the Script Encoder.

Writing Encoded Scripts.

Running Encoded Scripts.

Review.

28. Scripting Security.

Why Scripting Can Be Dangerous.

Security Improvements in Windows XP and Windows Server 2003.

Digitally Signing Scripts.

Running Only Signed Scripts.

Ways to Implement Safe Scripting.

The Filename Extension Game.

Script Signing.

Antivirus Software.

Defunct Techniques.

Review.

VI. READY-TO-RUN EXAMPLES.

29. Logon and Logoff Scripts.

NT and Active Directory Logon Scripts.

Active Directory-Specific Logon Scripts.

Active Directory Logoff Scripts.

Review.

30. Windows and Domain Administration Scripts.

Automating User Creation.

Finding Inactive Users.

Collecting System Information.

Review.

31. Network Administration Scripts.

Shutting Down Remote Computers.

Listing Remote Shares.

Finding Out Who Has a File Open.

Uninstall Remote MSI Packages.

Adding Users from Excel.

Listing Hot Fixes and Software.

Review.

32. WMI and ADSI Scripts.

The All-Purpose WMI Query Script.

The All-Purpose WMI Update Script.

The All-Purpose ADSI Object Creation Script.

The All-Purpose ADSI Object Query Script.

The All-Purpose ADSI Object Deletion Script.

Mass Password Changes with ADSI.

Review.

VII. APPENDIX.

Appendix. Administrator's Quick Script Reference.
Index.