Scripting Standards
As you identify tasks that you can perform with scripts, you will quickly have a large collection of scripts that you want to save, share with other administrators, and reuse. For ease of use and maintenance, you should develop a scripting standard that all administrators follow when creating and editing scripts in the collection. Following a standard style allows any administrator to open a script, know its purpose, and make any necessary customization. Following a standard scripting or coding style will make your scripts easier to read. There are also many text-editing tools that display the various components in different colors, making reading easier.
Below are some suggestions for scripting standards.
-
Comment section at the top of the script that contains the script's name, author, creation date, modified date, modified by, description (its purpose), and requirements and dependencies of the script (e.g., AD-specific, EFT Enterprise only), if any.
-
Comments before each subsection stating the purpose of the section
-
Comments regarding where the data or result is stored or comes from (e.g., writes the result to the Windows Event Viewer; appears in EFT Admin Actions report)
-
Coding conventions might include naming conventions for objects, variables, and procedures; commenting conventions; and text formatting and indenting guidelines
The example below shows a basic header and commented subsections.
1 ' FILE: SetPermission 2 ' CREATED: 13 OCT 2004 RTO 3 ' PURPOSE: Creates a user, creates some virtual folders, and sets various permissions. 4 ' DEPENDENCIES: Be sure to edit the script for your connections parameters 5 ' (Admin ID, Password, Port, Server...). 6 ' ==================================== 7 Private Sub Command1_Click() 8 9 Set oSFTPServer = CreateObject("SFTPCOMInterface.CIServer") 'instantiate EFT COM Object 10 11 12 ' ===================================== 13 ' Initialize connection parameters 14 ' ===================================== 15 16 Dim sAdminID, sAdminPassord, sAdminServer, oSites, oSite 17 sAdminID = "eft"'change this to your admin username 18 sAdminPassword = "eftserver"'change this to your admin password 19 sAdminPort = "1100"'change this to your admin port 20 sAdminServer = "10.0.1.2"'change this to the IP address for the admin connection to the Server