6
Machine-Specific Scripting
So far, we have demonstrated the use of scripts that will run unattended on any number of workstations, quietly managing, reporting, and configuring as required by the administrator. These scripts even maintain themselves, noting when they become obsolete and replacing themselves when changes on a remote server suggest that they should do so. While there are many circumstances in which this functionality is more than sufficient, there is one major limitation: none of the techniques or scripts we have described is able to differentiate its behavior depending on the machine on which it is being run. This may not pose a problem if the tasks being carried out are all routine and generally applicable, but it does impose severe restrictions if the purpose of scripting is to automate reconfiguration of a machine or if you require certain tasks to be carried out only on specific machines.
In this chapter, we explain how to enhance the techniques already described by writing scripts whose actions are partially determined by the specific workstation on which they are running. First, we demonstrate the extraction and comparison of an identifier that can be found trivially within the registry. We then describe types of situations in which such an identifier falls short; the bulk of the chapter is devoted to describing various ways of extracting information that unambiguously and uniquely identifies a workstation. It is this latter type that we use exclusively in ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access