LISTING 1: HDTemplate.cmd Script to Create SMS Security Manager Help Desk Template @Echo off Rem Throughout this script, indented lines should be Rem appended to the line before them. They are wrapped Rem only for readability. Rem This section ensures that if the user doesn't enter all Rem the necessary information, the script will display the Help Rem screen and then exit. IF "%1"=="" GOTO Help IF "%2"=="" GOTO Help IF "%3"=="" GOTO Help IF "%4"=="" GOTO Help Rem The script pulls the options the user specified at the command Rem line and sets the following environment variables to those Rem values. Set SqlSvrName=%2 Set SMSDbName=%3 Set SMSGrpName=%4 %5 %6 %7 %8 %9 Rem The following block creates a .SQL file so that ISQL can Rem process it and create the template. IF exist %temp%\Config.sql Del %temp%\Config.sql Echo INSERT SecurityUserTemplates VALUES ('%SMSGrpName%', 'Architectures', 'R') >>%temp%\Config.sql Echo INSERT SecurityUserTemplates VALUES ('%SMSGrpName%', 'Diagnostics', 'RW') >>%temp%\Config.sql Echo INSERT SecurityUserTemplates VALUES ('%SMSGrpName%', 'Helpdesk', 'RW') >>%temp%\Config.sql Echo INSERT SecurityUserTemplates VALUES ('%SMSGrpName%', 'Site Groups', 'R') >>%temp%\Config.sql Echo INSERT SecurityUserTemplates VALUES ('%SMSGrpName%', 'Sites', 'R') >>%temp%\Config.sql Rem This block checks to see whether the user is using standard or Rem trusted security and branches to the appropriate section Rem based on what the user specifies. IF "%1"=="/s" GOTO Standard_Security IF "%1"=="/t" GOTO Trusted_Security :Trusted_Security ISQL /S %SqlSvrName% /E /d %SMSDbName% /o %temp%\sqlresults.txt /i %temp%\Config.sql Echo. Echo Security template successfully created... Echo. Goto End :Standard_Security ISQL /S %SqlSvrName% /d %SMSDbName% /o %temp%\sqlresults.txt /i %temp%\Config.sql Echo. Echo Security template successfully created... Echo. Goto End :Help Echo. Echo This script is designed to add a custom Help desk template Echo to the SQL database using the parameters specified by Microsoft Echo for a Help desk user. Echo. Echo Proper Syntax is: 'HD_Template /S SQLServerName DatabaseName NewGroupName' OR Echo 'HD_Template /T SQLServerName DatabaseName NewGroupName' Echo Echo. Echo Examples: 'HD_Template /S Sql_server SMS Help_Desk' Echo 'HD_Template /T Sql_server SMS New group' :End Rem Cleans up environment variables and deletes temp file. Delete %temp%\Config.sql Set SqlSvrName= Set SMSDbName= Set SMSGrpName=