《Microsoft WINDOWS SCRIPTING自学指南 英文》PDF下载

  • 购买积分:13 如何计算积分?
  • 作  者:(美)艾德·威尔森著
  • 出 版 社:世界图书上海出版公司
  • 出版年份:2007
  • ISBN:7506283190
  • 页数:381 页
图书介绍:本书对于如何用脚本来自动化管理Windows系统给出了专家级的指导意见,这些指导意见直接来源于微软的脚本专家。本书有实用、易懂的自学练习、省时技巧,还有脚本样本,可帮助你事半功倍。

Part 1 Covering the Basics 1

1 Starting from Scratch 3

Before You Begin 3

Running Your First Script 3

Header Information 5

Reference Information 7

Worker Information 9

Output Information 10

Enhancing Your Script 11

Docs That Make House Calls 12

Modifying an Existing Script 13

Modifying the Header Information 14

Modifying the Reference Information 15

Modifying the Worker Information 17

Modifying the Output information 18

Summary 20

Quiz Yourself 21

On Your Own 21

Lab 1 Exploring a VBScript 21

Lab Instructions 21

Lab 2 Customizing an Existing Script 22

Scenario 22

Lab Instructions 22

2 Getting in the Loop 25

Before You Begin 25

Adding Power to Scripts 25

Header Information 27

Reference Information 30

Worker Information 30

For...Next 30

Header Information 31

Reference Information 32

Worker and Output Information 33

Do While...Loop 35

Header Information 36

Reference Information 37

Worker and Output Information 37

Do Until...Loop 38

Worker and Output Information 40

Summary 42

Quiz Yourself 42

On Your Own 43

Lab 3 Using the For Each...Next Command 43

Lab Instructions 43

Lab 4 Modifying the Ping Script 44

Lab Instructions 44

3 Adding Intelligence 45

Before You Begin 45

If...Then 45

Header Information 47

Reference Information 48

Worker and Output Information 49

Intrinsic Constants 50

If...Then...Elself 51

Header Information 52

Reference Information 52

Worker and Output Information 53

If...Then...Else 54

Select Case 55

Header Information 56

Reference Information 57

Worker and Output Information 58

Summary 59

Quiz Yourself 59

On Your Own 60

Lab 5 Modifying CPUType.vbs 60

Lab Instructions 60

Lab 6 Modifying ComputerRoles.vbs 61

Scenario 61

4 The Power of Many 65

Before You Begin 65

Passing Arguments 65

Command-Line Arguments 65

Making the Change 66

Running from the Command Prompt 67

No Arguments? 67

Creating a Useful Error Message 68

Using Multiple Arguments 69

Header Information 70

Reference Information 71

Worker and Output Information 71

Tell Me Your Name 72

Reasons for Named Arguments 72

Making the Change to Named Arguments 73

Running a Script with Named Arguments 74

Working with Arrays 75

Moving Past Lame Arrays 76

Header Information 76

Reference Information 77

Worker and Output Information 77

What Does UBound Mean? 78

Two-Dimensional Arrays 79

Mechanics of Two-Dimensional Arrays 80

Header Information 81

Reference Information 81

Worker and Output Information 81

Summary 82

Quiz Yourself 83

On Your Own 83

Lab 7 Working with Passing Arguments 83

Lab Instructions 83

Lab 8 Building Arrays 88

Lab Instructions 88

Lab 9 Modifying a Script 90

Lab Instructions 90

5 The Power of Many More 93

Before You Begin 93

Strings and Arrays 93

Parsing Passed Text into an Array 94

Header Information 95

Reference Information 96

Worker Information 97

Output Information 98

Parsing Passed Text 99

Header Information 101

Reference Information 101

Worker Information 102

Output Information 102

Working with Dictionaries 103

Using the Dictionary 104

Adding Items to the Dictionary 105

Summary 105

Quiz Yourself 106

Own Your Own 106

Lab 10a Implementing Basics for the InStr Command 106

Lab Instructions 106

Lab 10b Understanding Advanced Features of the InStr Command 107

Lab Instructions 107

Lab 11 Creating a Dictionary 108

Lab Instructions 108

Part 2 Basic Windows Administration 113

6 Working with the File System 113

Before You Begin 113

Creating File System Object 113

File It Under Files 114

Header Information 114

Reference Information 115

Worker and Output Information 116

File Properties 116

File Attributes 117

Implementing the Attributes Property 118

Setting File Attributes 119

A File,a File,I Need to Create a File 120

Writing to a Text File 120

How Shall I Write Thee?Let Me Count the Ways 121

Overwriting a File 121

Existential File Approaches 123

Summary 124

Quiz Yourself 124

On Your Own 125

Lab 12 Creating Files 125

Lab 13 Creating a Log File 126

7 Fun with Folders 129

Before You Begin 129

Working with Folders 129

Creating the Basic Folder 130

Header Information 131

Reference Information 131

Worker Information 131

Output Information 132

Automatic Cleanup 132

Deleting a Folder 133

Deleting Multiple Folders 133

Binding to Folders 134

Does the Folder Exist? 135

Copying Folders 135

Moving On Up 136

Summary 137

Quiz Yourself 137

On Your Own 138

Lab 14 Creating Folders 138

Lab 15 Deleting Folders 139

8 Why Windows Management Instrumentation? 143

Before You Begin 143

What IS WMI? 144

An Object in Any Other Namespace 144

More Than Just a Name 146

Providers 147

Adding a Touch of Class 149

Querying WMI 150

Header Information 151

Reference Information 151

Worker and Output Information 152

Summary 153

Quiz Yourself 154

On Your Own 154

Lab 16 Retrieving Hotfix Information 154

Lab Instructions 154

Lab 17 Echoing the Time Zone 156

Lab Instructions 156

9 WMI Continued 157

Before You Begin 157

Alternate Ways of Configuring the WMI Moniker 157

Accepting Defaults 158

Reference Information 158

Worker and Output Information 159

Moniker Security Settings 161

WbemPrivilege Has Its Privileges 163

Summary 164

Quiz Yourself 164

On Your Own 165

Lab 18a Using the Default WMI Moniker 165

Lab Instructions 165

Lab 18b Invoking the WMI Moniker to Display the Machine Boot Configuration 166

Lab Instructions 166

Lab 18c Including Additional Security Permissions 167

Lab Instructions 167

Lab 19 Using Win32_Environment and VBScript to Learn About WMI 169

Lab Instructions 169

10 Using WMI Queries 171

Before You Begin 171

Tell Me Everything About Everything! 171

Next 173

Header information 173

Reference Information 173

Worker and Output Information 174

Selective Data from All Instances 175

Selecting Multiple Properties 176

Specifying Specifics 177

Smooth Operator 178

Where Is the Where Clause? 179

Summary 180

Quiz Yourself 180

On Your Own 181

Lab 20 Writing an Informative WMI Script 181

Lab Instructions 181

Lab 21a Obtaining More Direct Information 183

Lab Instructions 183

Lab 21b Using a More Complicated Where Clause 184

Lab Instructions 184

Part 3 Advanced Windows Administration 187

11 Introduction to Active Directory Service Interfaces 187

Before You Begin 187

Working with ADSI 187

Reference Information 188

ADSI Providers 189

LDAP Names 190

Worker Information 191

Output Information 193

Creating Users 194

Reference Information 194

Worker Information 195

Output Information 195

Summary 196

Quiz Yourself 196

On Your Own 196

Lab 22 Creating OUs 196

Lab Instructions 196

Lab 23 Creating Multi-Valued Users 198

Lab Instructions 198

12 Reading and Writing for ADSI 201

Before You Begin 201

Working with Users 202

General User Information 202

Reference Information 204

Worker Information 204

Output Information 205

Creating the Second Page 206

Reference Information 207

Worker Information 207

Output Information 209

Deleting Users 210

Summary 211

Quiz Yourself 211

On Your Own 212

Lab 24 Deleting Users 212

Lab Instructions 212

Lab 25 Using the Event Log 213

Lab Instructions 213

13 Searching Active Directory 215

Before You Begin 215

Connecting to Active Directory to Perform a Search 215

Header Information 217

Reference Information 217

Worker and Output Information 218

Creating More Effective Queries 219

Searching for Specific Types of Objects 222

Reference Information 223

Output Information 223

What Is Global Catalog? 224

Summary 226

Quiz Yourself 227

On Your Own 227

Lab 26 Creating an ADO Query into Active Directory 227

Lab Instructions 227

Lab 27 Controlling How a Script Executes Against Active Directory 229

Lab Instructions 229

14 Configuring Networking Components 231

Before You Begin 231

WMI and the Network 231

Making the Connection 232

Header Information 233

Reference Information 234

Worker and Output Information 235

Changing the TCP/IP Settings 236

Header Information 237

Reference Information 237

Worker and Output Information 237

Merging WMI and ADSI 238

Win32_NetworkAdapterConfiguration 239

Summary 241

Quiz Yourself 241

On Your Own 242

Lab 28 Using WMI to Assign Network Settings 242

Lab Instructions 242

Lab 29 Combining WMI and ADSI in a Script 243

Lab Instructions 243

15 Subs and Other Round Things 245

Before You Begin 245

Working with Subroutines 245

Calling the Subroutine 248

Creating the Subroutine 248

Creating Users and Logging Results 249

Header Information 251

Reference Information 252

Worker Information 252

Output Information 253

Summary 254

Quiz Yourself 255

On Your Own 255

Lab 30 Using ADSI and Subs,and Creating Users 255

Lab Instructions 255

Lab 31 Adding a Logging Subroutine 257

Lab Instructions 257

16 Logon Scripts 261

Before You Begin 261

Working with IADsADSystemInfo 261

Using Logon Scripts 263

Deploying Logon Scripts 264

Header Information 265

Reference Information 266

Worker Information 269

Output Information 269

Summary 270

Quiz Yourself 271

On Your Own 271

Lab 32 Adding a Group to a Logon Script 271

Lab Instructions 271

Lab 33 Adding Logging to a Logon Script 272

Lab Instructions 272

17 Working with the Registry 277

Before You Begin 277

First You Back UP 277

Creating the WshShell Object 278

Setting the comspec Variable 279

Defining the Command Line 279

Connecting to the Registry 280

Header Information 281

Reference Information 281

Worker and Output Information 282

Unleashing StdRegProv 283

Creating Registry Keys 284

Header Information 285

Reference Information 285

Worker and Output Information 285

Writing to the Registry 286

Deleting Registry Information 287

Summary 288

Quiz Yourself 288

On Your Own 288

Lab 34 Reading the Registry Using WMI 288

Lab Instructions 288

Lab 35 Creating Registry Keys 290

Lab Instructions 290

18 Working with Printers 293

Before You Begin 293

Working with Win32_Printer 293

Obtaining the Status of Printers 295

Header Information 296

Reference Information 296

Worker Information 297

Output Information 297

Creating a Filtered Print Monitor 298

Reference Information 300

Output Information 300

Monitoring Print Queues 301

Worker and Output Information 302

Summary 302

Quiz Yourself 303

On Your Own 303

Lab 36 Monitoring Print Jobs 303

Lab Instructions 303

Lab 37 Checking the Status of a Print Server 305

Lab Instructions 305

Part 4 Scripting Other Applications 309

19 Managing IIS 6.0 309

Before You Begin 309

What's in a Name? 309

Using MicrosoftIISv2 310

Making the Connection 311

Header Information 311

Reference Information 312

Worker and Output Information 313

Creating a Website 313

Header Information 314

Reference Information 315

Worker and Output Information 316

Summary 317

Quiz Yourself 317

On Your Own 318

Lab 38 Backing Up the Metabase 318

Lab Instructions 318

Lab 39 Importing the Metabase 319

Lab Instructions 320

20 Working with Exchange 2003 323

Before You Begin 323

Working with the Exchange Provider 323

Connecting to MicrosoftExchangeV2 325

The Exchange_QueueSMTPVirtualServer Class 325

Header Information 326

Reference Information 326

Worker Information 327

Output Information 327

Exchange Public Folders 327

Summary 330

Quiz Yourself 330

On Your Own 331

Lab 40 Using the Exchange_Logon Class 331

Lab Instructions 331

Lab 41 Using the Exchange_Mailbox Class 333

Lab Instructions 333

Part 5 Appendices 339

A VBScript Documentation 339

Constants 339

VBScript Run-Time Errors 341

VBScript Syntax Errors 342

B ADSI Documentation 345

Computer Object Mapping 345

Domain Object User Interface Mapping 346

Group Object User Interface Mapping 346

Object Property Sheet 347

Organizational Unit User Interface Mapping 348

Printer Object User Interface Mapping 348

Shared Folder Object User Interface Mapping 349

User Object User Interface Mapping 349

C WMI Documentation 353

Win32 Classes 353

WMI Providers 353

WMI Scripting API Objects 355

WMI Log Files 357

D Documentation Standards 359

Header Information Section 359

Reference Information Section 359

Worker Information Section 359

Sample of Documentation Use 360

Index 361