![]() |
Table of Contents |
![]() |
Creating a Task ListThe first thing to do in the design process is to create a task list. This is essentially an English-language version of the script you plan to write. In the list, you must break down the various things you want the script to perform in as much detail as possible. I often go through several iterations of the task list, adding a bit more detail each time through. Listing 4.1 shows what my first pass might look like. Listing 4.1. Login script task list. Your first task list should just summarize what you want the script to do.Login script task list Display a logon welcome message. Map the N: drive based on group membership. Map the R: drive based on group membership. Map the S: drive based on group membership. Map a printer and make it the default. Base the printer selection on the user's physical location at the time. NOTE Programmers call this kind of a task list pseudocode, because it sort of looks like programming code but isn't. It's a great way to lay out what a script is supposed to do without having to look up the exact VBScript syntax of every command. Plus, you can throw around phrases like, "I just finished pseudocoding that script, and boy was it tough," and you'll impress the software developers in your company. After you've got your first task list completed, look at what detail might be missing. For example, "based on group membership" is vague. What specific parameters will be used to determine where the N: drive is mapped? Will the N: drive always be mapped, or will it be mapped only if the user is in one or more specific groups? Pretend you're explaining how the script will work to the least technical person you know, and add the level of detail they'd need to understand what the script should do. Listing 4.2 shows a second, more detailed attempt. Listing 4.2. Login script task list II. Adding detail makes the task list more useful.Login script task list v2 Display a logon welcome message: "Welcome to BrainCore.Net. You are now logged on." Map the N: drive: If the user is a member of the Domain Users group. Map the drive to \\Server\Users. Map the R: drive: If the user is a member of the Research group. Map the drive to \\Server2\ResearchDocs. Map the S: drive: If the user is a member of the Sales group. Map the drive to \\Server2\SalesDocs. Map a printer: Examine the third octet of the user's IP address. If it is 100, map the printer \\NYDC\HPColor3. If the third octet is 110, map the printer to \\LADC2\HP6. If the third octet is 120, map the printer to \\ TXDC1\LaserJet. Make the mapped printer the default on the user's system. This new script provides much more in the way of detail. However, it's still lacking the feel of a procedure. For example, suppose you were going to manually perform the tasks in this script. How would you perform the drive-mapping task? You'd have to open the Domain Users group and see if the user's account was listed there. Rewrite the task list with that level of procedural detail, because that's what the computer executing the script will need to know. Look at Listing 4.3, which tries to make the task list even more detailed and procedural. Listing 4.3. Login script task list III. Making the tasks a procedure will help translate the list to a script later.Login script task list v3 Display a logon welcome message: "Welcome to BrainCore.Net. You are now logged on." Wait until the user presses OK to dismiss the welcome message. Map the N: drive: Obtain a list of Domain Users group members. See if the user is in the list. If they are, map the drive to \\Server\Users. Map the R: drive: Obtain a list of Research group members. See if the user is in the list. If they are, map the drive to \\Server2\ResearchDocs. Map the S: drive: Obtain a list of Sales group members. See if the user is in the list. If they are, map the drive to \\Server2\SalesDocs. Map a printer: Get the user's IP address. Look at just the third octet. To find it, look for the last period in the IP address, and then the next-to-the- last period. The third octet is between the two periods. If the octet is 100, map to \\NYDC\HPColor3. If it's 110, map to \\LADC\HP6. If it's 120, map to \\TXDC1\LaserJet. Then make the mapped printer the default. Now take one last pass through the list and think about the underlying technologies. For example, what information is really contained within a Windows domain user group? It's not a list of user names; it's a list of security identifiers, or SIDs. So, when you're checking group membership, you may need to get the user's SID and then check the groups' SID list. You don't necessarily need to modify your task list with this information, but make a note of it. That way when you start to write the script in VBScript, you'll remember what it is you really need the computer to do for you. |
![]() |
Table of Contents |
![]() |