VBScript, WMI and ADSI unleashed: using VBSscript, WMI, and ADSI to automate Windows administration

Free Download

Authors:

Edition: 2

ISBN: 0321501713, 9780321501714

Size: 5 MB (5700893 bytes)

Pages: 574/574

File format:

Language:

Publishing Year:

Category:

Don Jones0321501713, 9780321501714

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.

Table of contents :
VBScript, WMI, and ADSI Unleashed……Page 1
Table of Contents……Page 6
Introduction……Page 20
How to Use This Book……Page 21
Part II: VBScript Tutorial……Page 22
Part III: Windows Management Instrumentation and Active Directory Services Interface……Page 24
Part IV: Advanced Scripting Techniques……Page 25
Part V: Ready-to-Run Examples……Page 26
Typographical Elements……Page 27
Sample Scripts—Explained……Page 28
Part I: Introduction to Windows Administrative Scripting……Page 30
Overview of Scripting……Page 32
Script Hosts……Page 33
ActiveX Scripting Languages……Page 35
Critical Scripting Security Issues……Page 37
VBScript Versus Windows PowerShell……Page 38
Summary……Page 39
Windows Script Host……Page 40
Command-Line Scripts……Page 42
Notepad and Script Editors……Page 44
Writing Your First Script……Page 52
Debugging Your First Script……Page 54
Summary……Page 56
A Typical VBScript……Page 58
Functions……Page 61
Subroutines……Page 62
Main Script……Page 63
Comments and Documentation……Page 67
Summary……Page 72
4 Designing a Script……Page 74
Creating a Task List……Page 75
Selecting the Appropriate Tools……Page 77
Creating Modules to Perform Tasks……Page 82
Validating User Input……Page 88
Planning for Errors……Page 89
Summary……Page 91
Part II: VBScript Tutorial……Page 92
5 Functions, Objects, Variables, and More……Page 94
Variables Defined……Page 95
Functions Defined……Page 104
Statements and Subroutines Defined……Page 111
Objects Defined……Page 113
Summary……Page 118
Displaying Messages……Page 120
Asking for Input……Page 127
Command-Line Parameters as Input……Page 129
Summary……Page 133
Numbers in VBScript……Page 134
Basic Arithmetic……Page 135
Advanced Arithmetic……Page 137
Boolean Math……Page 140
Converting Numeric Data Types……Page 145
Summary……Page 146
Strings in VBScript……Page 148
Working with Substrings……Page 150
Concatenating Strings……Page 154
Changing Strings……Page 158
Formatting Strings……Page 160
Converting Other Data Types to String Data……Page 161
Summary……Page 162
Working with Dates and Times……Page 164
Working with Arrays……Page 167
Working with Bytes……Page 171
Summary……Page 172
Conditional Execution……Page 174
Loops……Page 181
Putting It All Together……Page 186
Summary……Page 189
The WScript Object……Page 192
The Network Object……Page 193
The ADSystemInfo Object……Page 198
The Shell Object……Page 199
The Shortcut Object……Page 206
Objects in Detail……Page 208
Summary……Page 210
The FileSystemObject Library……Page 212
Working with Drives……Page 213
Working with Folders……Page 216
Working with Files……Page 222
Reading and Writing Text Files……Page 225
Other FSO Methods and Properties……Page 228
Creating a Log File Scanner……Page 230
Summary……Page 237
Designing the Script……Page 238
Writing Functions and Subroutines……Page 242
Writing the Main Script……Page 247
Testing the Script……Page 253
Summary……Page 263
Part III: Windows Management Instrumentation and Active Directory Services Interface……Page 264
Using ADSI Objects……Page 266
Using the WinNT Provider……Page 268
Using the LDAP Provider……Page 271
Other Providers……Page 273
Summary……Page 274
Querying Domain Information……Page 276
Changing Domain Settings……Page 278
Working with OUs……Page 279
Putting It All Together……Page 283
Summary……Page 288
Creating Users and Groups……Page 290
Querying User Information……Page 292
Changing User Settings……Page 293
Working with Groups……Page 294
Putting It All Together……Page 296
Summary……Page 300
The WMI Hierarchy……Page 302
Exploring WMI’s Capabilities……Page 305
Installing WMI……Page 309
Using the WMI Tools……Page 310
The Easy Way to Write WMI Scripts……Page 312
Summary……Page 316
The WMI Query Language (WQL)……Page 318
Determining What to Query……Page 323
Testing the Query……Page 325
Writing the Query in VBScript……Page 327
Using the Query Results……Page 331
Alternative Methods……Page 333
Summary……Page 335
Understanding WMI Relationships……Page 336
Associating WMI Instances……Page 340
Testing the Query……Page 344
Writing the Query in VBScript……Page 345
Another Example……Page 349
Summary……Page 352
Designing the Script……Page 354
Writing Functions and Subroutines……Page 359
Writing the Main Script……Page 362
Testing the Script……Page 370
Summary……Page 374
21 Testing and Debugging WMI and ADSI Queries……Page 376
Debugging WMI Queries……Page 377
Debugging ADSI Queries……Page 385
Summary……Page 389
Part IV: Advanced Scripting Techniques……Page 390
Looking for Modules……Page 392
Scripting and XML……Page 397
Summary……Page 407
23 Scripts Packaging and Protection……Page 408
Writing Encoded Scripts……Page 409
Running Encoded Scripts……Page 412
Script Packaging……Page 413
Summary……Page 416
Why Scripting Can Be Dangerous……Page 418
Security Improvements in Windows XP and Windows Server 2003……Page 419
Digitally Signing Scripts……Page 421
Running Only Signed Scripts……Page 423
Ways to Implement Safe Scripting……Page 424
Summary……Page 426
25 Introduction to HTML Applications……Page 428
How an HTA Is Built……Page 429
Steps for Writing an HTA……Page 430
Summary……Page 439
Types of Bugs……Page 440
Preventing Syntax Errors……Page 441
Debugging Logic Errors……Page 444
Summary……Page 454
Part V: Ready-to-Run Examples……Page 456
27 Logon and Logoff Scripts……Page 458
NT and Active Directory Logon Scripts……Page 459
Active Directory–Specific Logon Scripts……Page 465
Active Directory Logoff Scripts……Page 470
Summary……Page 472
Automating User Creation……Page 474
Finding Inactive Users……Page 483
Collecting System Information……Page 488
Templates……Page 493
Summary……Page 499
Shutting Down Remote Computers……Page 500
Listing Remote Shares……Page 503
Finding Out Who Has a File Open……Page 505
Uninstalling Remote MSI Packages……Page 508
Listing Hot Fixes and Software……Page 511
Summary……Page 514
The All-Purpose WMI Query Script……Page 516
The All-Purpose WMI Update Script……Page 518
The All-Purpose ADSI Object Creation Script……Page 519
The All-Purpose ADSI Object Deletion Script……Page 521
Mass Password Changes with ADSI……Page 522
Updating Service Accounts……Page 524
Summary……Page 527
Appendix: Administrator’s Quick Script Reference……Page 528
A……Page 542
B……Page 544
C……Page 545
D……Page 547
E……Page 549
F……Page 550
H……Page 553
I……Page 554
L……Page 555
M……Page 557
N……Page 559
O……Page 560
P……Page 561
R……Page 563
S……Page 564
T……Page 568
U……Page 569
V……Page 570
W……Page 571
X–Z……Page 574

Reviews

There are no reviews yet.

Be the first to review “VBScript, WMI and ADSI unleashed: using VBSscript, WMI, and ADSI to automate Windows administration”
Shopping Cart
Scroll to Top