Windows 2000 or later required (some commands are native to XP/2003 only)
Non-Native Utilities Required:
This script requires the NT Resource Kit as well as quite a few other utilities such as BLAT, various PSTOOLS from SysInternals, and ports of Unix utils (e.g. HEAD, TAIL). You can find these files in the UTILS folder, but they are provided only to facilitate the testing of the script. If you choose to use this script and these utilities in your environment, you MUST license the commercial ones for your organization (some of them are actually free, thankfully).
RUNNING UNDER WINDOWS NT4
This script has configured to run under Win2K/XP/2003. That is to say: While it was originally designed, and spent a number of years running successfully under NT4, it has since been modified rather extensively to take advantage of the power and flexibility of the more recent versions of Windows -- particularly when it comes to the use of environment variables and passing info to subroutines. As a result, it will require substantial modifications to run properly under NT4. For that matter, some of the utils that are called may not properly work under NT4. It's not like you should even be using NT4 systems anymore, anyway! :D
ENUMERATING SYSTEMS IN THE DOMAIN
Earlier versions of this script which used NET VIEW only have been replaced by NETDOM which has more functionality. One other benefit of using NETDOM is that it will work in environments where NetBIOS has been disabled. NET VIEW, however, will not work without NetBIOS. A modification has been made to attempt NET VIEW first (because it's MUCH faster, and most people are still using NetBIOS). The other advantage of NET VIEW is that it will enumerate machines that are on the network, but not on the domain. For the most part, I just use the /L parameter of this script to use the pre-generated ServerList.TXT file, rather than risk domain enumeration for each script run.
A list of the servers should be placed in the INPUT folder. Also, the "@Variables.BAT" file is needed from the INPUT folder in order to set all of the global variables for this script, along with some of the other scripts that can be found in the UltraTech Knowledgebase archive. You are free to modify any or all of the scripts to make them more independent. At some point, I need to document some of the recent changes in the "@Variables.BAT" script which allow you to use custom input files for any given server, without having to modify the scripts. One such example is the ServerList input file which is usually: C:\Scripts\Bat\Input\ServerList.TXT
The custom version would contain the name of the current server as follows: C:\Scripts\Bat\Input\ServerList.localservername.TXT e.g. C:\Scripts\Bat\Input\ServerList.SERVER1A.TXT
DEBUGGING YOUR SCRIPTS
You'll notice that this script contains lots of "IF %DEBUG%"
statements (used in conjunction with the new variable called [email protected]_IF_DEBUG%)
. I tend to use these mechanisms quite a bit in larger scripts. This way, if the script fails to run properly, you can go to a command prompt and issue the following command: SET DEBUG=TRUE
Now, when you run the script in that command session, it will turn ECHO
on, and enable a pause or delay after each major module to allow you to see the output. This will help you to determine where things are going wrong without having to go back into the script and add a bunch of PAUSE
NOTE: One of the interesting things about 2000/2003 Shell scripting is that it doesn't appear to be possible to CALL a subroutine from within a nested parenthetical loop. Very weird, but easily worked around.
I really, really, REALLY need to get working on converting these scripts over to VBScript, as opposed to working on them further in this format. Ah, one day I'll have some time! Ha...
(Mar 2006) I've been saying this for years now. It seems more likely that I'll just convert them over to Microsoft Scripting Host (MSH) aka MONAD sometime in mid-to-late 2007.
ADDITIONAL SCRIPTING INFO
For More Scripting Assistance, see the following:
Batch File Parameters
/H - Display This Help Message
/Q - Generate Log File, But Don't Send Mail
/M - Mail Current Log File without Regenerating It First
/T - Use A Test List of Servers/Computers
/L - Use Pre-Existing Computer List; Don't Enumerate Domain
Example: OpsLogs /Q /T
Providing Competitive Advantage through Effective IT Leadership