December 23, 2018

26 Oct Go beyond simple queries and get the inside track on how to write system administration scripts with Windows Management Instrumentation. Selection from Microsoft® Windows® Scripting Self-Paced Learning Guide [Book] Scripting Host (WSH), Windows Management Instrumentation (WMI), and. Microsoft Windows Scripting with WMI: Self-Paced Learning Guide [Ed Wilson] on *FREE* shipping on qualifying offers. Go beyond simple queries.

Author: Fegor Akinogis
Country: Uzbekistan
Language: English (Spanish)
Genre: Art
Published (Last): 3 March 2016
Pages: 334
PDF File Size: 8.23 Mb
ePub File Size: 18.31 Mb
ISBN: 913-6-20874-177-5
Downloads: 90335
Price: Free* [*Free Regsitration Required]
Uploader: Mikakasa

Ensure the variable name is separated from the registry key name with an equal sign. On the next line, assign a value to a variable. You also looked at using variables to streamline WMI queries and connection strings.

For what purpose is Option Explicit used? After using End If, you have the Loop command on a line by itself. This time, instead of simply referencing the WScript. Try to run the script. For example, in the following code, you can assume that the variable named ComputerName actually holds a computer name. How many ElseIf lines can be used in a script? Sample scripts and starter scripts for all labs.

Many of the concepts covered in this chapter will come up throughout this book, as well as in your day-to-day life as a network administrator, so be sure you understand the material here before moving on. This ability to pause the script can have a number of uses. Make sure you include every variable name identified in the Worker information section of the script. This line says that microsoct word DriveType is equal to the number 3. To run a script with named arguments, you use a forward slash and then enter the name of the argument.


This might be a useful and valid use of VBScript for, say, information gathering or troubleshooting. In this way, while you are writing and testing your script, you will be able to catch all the wmmi, because On Error Resume Next is turned off. Remember that anything inside the quotation marks will be echoed to the screen.

Microsoft Windows Scripting with WMI: Self-Paced Learning Guide by Ed Wilson

So what does Echo do? The revised line looks like the following: To prevent the script from choking, you need to indicate that you are adding the text. You want to use the number 3 later in the script when you build the WMI query.

Creating the WshShell Object. First You Back Up. The line begins with Scritping and ends with Then.

Leave the line WScript. Is This Book for Me? We use this kind of logic all the time. On the next line, enter the command lwarning want to invoke.

The first one is a computer name, and the second argument is the name of a service. Used to hold the connection string and query to WMI. Therefore, the assignment of your new variables to actual items will take place inside the For Each Next loop. You can do this in several ways. Lab 4 Modifying the Ping Script.

Constants do not change their values during script execution as variables can. Here are the chapters in Part 2: Name the four parts of a VBScript. There are several cool aspects of arrays; for example, you can populate them with information for later use in the script. Writing to a Text File. The text of computerRoles. Echo to return the four items required by the first part of the lab scenario. Copy the script to a share on a local server. You can automate populating an array by using the For…Next command.


Microsoft Windows scripting self-paced learning guide

Arrays are used to make scripts more powerful, efficient, and robust. In argComputerService, you use two arguments. Lab 32 Adding a Group to a Logon Script. Finally, you looked at modifying scripts and learned to determine which parts of the script can be re-used and which parts need to be re-created. Since it is a collection, you need to use For Each…Next to walk iterate through the collection. Loop The Do While…Loop allows you self-pace run a script as long as a certain condition is self-laced effect.

Earlier in this section, you learned that ArgComputerService requires two commandline arguments: Save and run the file. These are used to break up the code into more than one line to make the code easier to read. In the next part of the script, insert the equal sign and the same worker component you always do thiswhich in this case is the objShell.