################################################ # # # SYSGEM Enterprise Manager 2.3 build 5038 # # Copyright (C) 2009 SYSGEM AG # # # # Contents : Tasks # # # # Created by : Mike # # Timestamp : 2011-12-01 12:03:29 # # # ################################################ # 100 String Search on Files 102 # 101 Created 2011-11-09 14:10:54 by Mike # # 124 /*****************************/ 124 /* */ 124 /* CL Program */ 124 /* */ 124 /*****************************/ 124 # # 120 #++++++++++++++++++++++++++++++++++ 120 # | 120 # Windows NT script (PERL). | 120 # | 120 #++++++++++++++++++++++++++++++++++ 120 # 120 # 120 chdir($INPUT_FO); 120 120 system(DIR); 120 120 print "MKS [$INPUT_FO] [$INPUT_TX]\n"; 120 120 for my $file (<*>) 120 { 120 next unless open FILE, "< $file"; 120 120 my $line = 0; 120 while () 120 { 120 $line++; 120 next unless /$INPUT_TX/; 120 print "$file:$line $_\n"; 120 } 120 close FILE; 120 } # # 121 #!/bin/ksh -ph 121 # 121 #{{SHELL_IRIX #!/usr/bin/ksh 121 #{{SHELL_LINUX #!/bin/sh 121 # 121 #+++++++++++++++++++++++++++ 121 # | 121 # UNIX Shell script. | 121 # | 121 #+++++++++++++++++++++++++++ 121 # 121 # 121 # # 122 $!+++++++++++++++++++++++++++++ 122 $! | 122 $! VMS command file (DCL). | 122 $! | 122 $!+++++++++++++++++++++++++++++ 122 $! 122 $! # 145 144 141 146 142 143 130 FO 131 folder 132 133 0 134 135 0 136 137 138 16777215 139 150 151 000 152 153 0 154 0 156 1 157 1 & # 130 TX 131 Search Text 132 133 0 134 135 0 136 137 138 16777215 139 150 151 000 152 153 0 154 0 156 1 157 1 & # @ # 100 Configure 2.3 Agent Compatibility Mode 102 Upgrade Support Tasks # 101 Configures SEM Agents from SEM versions prior to 2.3 with additional security keys, to enable SEM 2.3 to use these agents in Agent Compatibility Mode. 101 101 NB: This task must be run before upgrading the SEM environment to version 2.3, as after that point the SEM Management Console will be unable to communicate with older versions of agents that have not been updated using this task. 101 101 Created 2009-10-06 16:09:28 by baljemmett 101 101 Modified 2009-11-10 11:35:03 by baljemmett # # 124 /*****************************/ 124 /* */ 124 /* CL Program */ 124 /* */ 124 /*****************************/ 124 124 IF COND(&INPUT_DI *EQ '1') THEN(DO) 124 CALL PGM(SEMAGENT) PARM('-k9', 'Agent' *CAT &INPUT_SK) 124 CALL PGM(SEMAGENT) PARM('-k8', 'AgCli' *CAT &INPUT_SK) 124 ENDDO 124 ELSE(DO) 124 CALL PGM(SEMAGENT) PARM('-r9') 124 CALL PGM(SEMAGENT) PARM('-r8') 124 ENDDO # # 120 #++++++++++++++++++++++++++++++++++ 120 # | 120 # Windows NT script (PERL). | 120 # | 120 #++++++++++++++++++++++++++++++++++ 120 # 120 # 120 120 use Win32::Process; 120 120 sub run($$) 120 { 120 my $process; 120 my ($exe, $command) = @_; 120 120 if (Win32::Process::Create($process, 120 $exe, 120 $command, 120 0, 120 NORMAL_PRIORITY_CLASS, 120 ".")) 120 { 120 $process->Wait(INFINITE); 120 return ""; 120 } 120 else 120 { 120 return Win32::FormatMessage(Win32::GetLastError()); 120 } 120 } 120 120 my $exe = "..\\SEM Server.exe"; 120 120 if ($INPUT_DI == 0) 120 { 120 print "Updating agent $SERVER_NAME for 2.3 Agent Compatibility Mode...\n"; 120 print "\n"; 120 120 my $error = ""; 120 120 $error = run($exe, sprintf('"%s" -k%d "%s"', $exe, 9, "Agent" . $INPUT_SK)) if $error eq ""; 120 $error = run($exe, sprintf('"%s" -k%d "%s"', $exe, 8, "AgCli" . $INPUT_SK)) if $error eq ""; 120 120 if ($error eq "") 120 { 120 print "Agent $SERVER_NAME updated for 2.3 Agent Compatibility Mode.\n"; 120 } 120 else 120 { 120 print "Agent $SERVER_NAME NOT updated for 2.3 Agent Compatibility Mode:\n"; 120 print "$error\n"; 120 } 120 } 120 else 120 { 120 print "Disabling 2.3 Agent Compatibility Mode on agent $SERVER_NAME...\n"; 120 print "\n"; 120 120 my $error = ""; 120 120 run($exe, sprintf('"%s" -r%d', $exe, 9)) if $error eq ""; 120 run($exe, sprintf('"%s" -r%d', $exe, 8)) if $error eq ""; 120 120 if ($error eq "") 120 { 120 print "Agent Compatibility Mode disabled on agent $SERVER_NAME.\n"; 120 } 120 else 120 { 120 print "Agent Compatibility Mode NOT disabled on agent $SERVER_NAME:\n"; 120 print "$error\n"; 120 } 120 } # # 121 #!/bin/ksh -ph 121 # 121 #{{SHELL_IRIX #!/usr/bin/ksh 121 #{{SHELL_LINUX #!/bin/sh 121 # 121 #+++++++++++++++++++++++++++ 121 # | 121 # UNIX Shell script. | 121 # | 121 #+++++++++++++++++++++++++++ 121 # 121 121 121 if [ $INPUT_DI -eq 0 ] 121 then 121 echo "Updating agent $SERVER_NAME for 2.3 Agent Compatibility Mode..." 121 echo "" 121 121 ./SysgemSEMAgent -k9 "Agent$INPUT_SK" 121 ./SysgemSEMAgent -k8 "AgCli$INPUT_SK" 121 121 echo "" 121 echo "Agent $SERVER_NAME updated for 2.3 Agent Compatibility Mode." 121 else 121 echo "Disabling 2.3 Agent Compatibility Mode on agent $SERVER_NAME..." 121 echo "" 121 121 ./SysgemSEMAgent -r9 121 ./SysgemSEMAgent -r8 121 121 echo "" 121 echo "Agent Compatibility Mode disabled on agent $SERVER_NAME." 121 fi # 122 $!+++++++++++++++++++++++++++++ 122 $! | 122 $! VMS command file (DCL). | 122 $! | 122 $!+++++++++++++++++++++++++++++ 122 $! 122 $! 122 $ IF INPUT_DI .EQ. 0 122 $ THEN 122 $ WRITE SYS$OUTPUT "Updating agent ''SERVER_NAME' for 2.3 Agent Compatibility Mode..." 122 $ ELSE 122 $ WRITE SYS$OUTPUT "Disabling 2.3 Agent Compatibility Mode on agent ''SERVER_NAME'..." 122 $ ENDIF 122 $! 122 $ HWTYPE == F$GETSYI("NODE_HWTYPE") 122 $! 122 $ IF HWTYPE .EQS. "IA64" 122 $ THEN 122 $ AGENT :== "$''P1'SEM-AGENT-IA64.EXE" 122 $ WRITE SYS$OUTPUT "(Running on Itanium hardware.)" 122 $ ELSE 122 $ IF HWTYPE .EQS. "ALPH" 122 $ THEN 122 $ AGENT == "$''P1'SEM-AGENT-AXP.EXE" 122 $ WRITE SYS$OUTPUT "(Running on Alpha hardware.)" 122 $ ELSE 122 $ AGENT == "$''P1'SEM-AGENT-VAX.EXE" 122 $ WRITE SYS$OUTPUT "(Running on VAX hardware.)" 122 $ ENDIF 122 $ ENDIF 122 $! 122 $ WRITE SYS$OUTPUT "" 122 $! 122 $ IF INPUT_DI .EQ. 0 122 $ THEN 122 $ AGENT -k9 "Agent''INPUT_SK'" 122 $ AGENT -k8 "AgCli''INPUT_SK'" 122 $! 122 $ WRITE SYS$OUTPUT "" 122 $ WRITE SYS$OUTPUT "Agent ''SERVER_NAME' updated for 2.3 Agent Compatibility Mode." 122 $ ELSE 122 $ AGENT -r9 122 $ AGENT -r8 122 $! 122 $ WRITE SYS$OUTPUT "" 122 $ WRITE SYS$OUTPUT "Agent Compatibility Mode disabled on agent ''SERVER_NAME'." 122 $ ENDIF 122 $! 122 # 145 144 141 146 142 143 130 HA 131 ~f~oEnter a Security Key that is valid for your SEM installation, and press OK to update the selected agents. 132 133 4 134 135 0 136 137 138 16777215 139 150 151 000 152 153 0 154 0 156 1 157 1 & # 130 HB 131 132 133 4 134 135 0 136 137 138 16777215 139 150 151 000 152 153 0 154 0 156 1 157 1 & # 130 DI 131 Disable Compatibility Mode 132 133 1 134 135 0 136 137 138 16777215 139 0 150 151 000 152 153 0 154 0 156 1 157 1 & # 130 SK 131 Security Key: 132 133 16 134 135 1 136 137 138 16777215 139 150 -DI 151 000 152 153 0 154 0 156 1 157 1 & # @ # 100 Upgrade Agent (for v2.3 GUIs) 102 Upgrade Support Tasks # 101 Perform an unattended upgrade of the SEM agent on one or more target Windows, OpenVMS or Unix agents. 101 101 This version of the script makes use of Task features introduced in version 2.3 build 4286; for older versions of the SEM GUI, please use the 'Upgrade Agent' task instead. 101 101 Before starting the upgrade, the relevant agent installation kits will need to be placed in a location accessible by the currently-installed SEM agent. If a shared directory is not available for this purpose, the SEM File and Directory Explorer can be used to copy the agent kit to the target systems and then automatically run this Task to perform the upgrade. 101 101 For more details on unattended upgrades of the SEM system, please contact Sysgem at support@sysgem.com. 101 101 Created 2009-07-08 10:51:27 by baljemmett 101 101 Last update: 101 Modified 2009-09-25 17:54:26 by baljemmett # # 124 /*****************************/ 124 /* */ 124 /* CL Program */ 124 /* */ 124 /*****************************/ 124 # # 120 #++++++++++++++++++++++++++++++++++ 120 # | 120 # Windows NT script (PERL). | 120 # | 120 #++++++++++++++++++++++++++++++++++ 120 # 120 # 120 120 use Win32::Process; 120 use Win32::Registry; 120 use File::Basename; 120 120 # 120 # Routine to obscure passwords in the installation response file 120 # 120 sub Encode($) 120 { 120 my @key = split //, "Sysgem"; 120 my $input = $_[0]; 120 my $output = ""; 120 my $idx = 0; 120 120 for (split //, $input) 120 { 120 $output .= sprintf("%02.2x", ord($_) ^ ord($key[$idx++ % @key])); 120 } 120 120 $output; 120 } 120 120 # 120 # Build response file to feed InstallShield 120 # 120 my $DERIVE_UN = "Registered User"; 120 my $DERIVE_CO = "Registered Company"; 120 my $DERIVE_WP = Encode($INPUT_WP); 120 my $DERIVE_LS = $INPUT_WT eq "Local System" ? 1 : 0; 120 my $DERIVE_CU = $INPUT_WT ne "Local System" ? 1 : 0; 120 my $DERIVE_ST = $INPUT_KT eq "Installation Key" ? 2 : 1; 120 my $DERIVE_KE = Encode($INPUT_KE); 120 120 my $KEYDIALOG = $INPUT_KT eq "Installation Key" ? "SdShowDlgEdit3" : "DlgGetSecurityKeyEx"; 120 120 # 120 # Dig out some values from the Registry 120 # 120 if ($HKEY_LOCAL_MACHINE->Open("SOFTWARE\\SYSGEM\\Installation", $hKeyInstallation)) 120 { 120 my $type, $value1, $value2; 120 $hKeyInstallation->QueryValueEx("User Name", $type, $value1) and $DERIVE_UN = $value1; 120 $hKeyInstallation->QueryValueEx("Company Name", $type, $value2) and $DERIVE_CO = $value2; 120 $hKeyInstallation->Close(); 120 } 120 120 # 120 # Expand out environment variables in install dir 120 # 120 $INPUT_WI =~ s/%([^% ]+)%/$ENV{$1}/eg; 120 120 # 120 # InstallShield appears to prefer ' ' to an empty entry 120 # 120 $DERIVE_UN = "' '" if $DERIVE_UN eq ""; 120 $DERIVE_CO = "' '" if $DERIVE_CO eq ""; 120 $DERIVE_WP = "' '" if $DERIVE_WP eq ""; 120 $DERIVE_KE = "' '" if $DERIVE_KE eq ""; 120 $INPUT_WI = "' '" if $INPUT_WI eq ""; 120 $INPUT_WU = "' '" if $INPUT_WU eq ""; 120 $INPUT_PN = "' '" if $INPUT_PN eq ""; 120 $INPUT_AS = "' '" if $INPUT_AS eq ""; 120 $INPUT_KE = "' '" if $INPUT_KE eq ""; 120 120 my $script = < $scriptname")) 120 { 120 print "Cannot create unattended response file: $!\n"; 120 exit; 120 } 120 120 print SCRIPT $script; 120 close SCRIPT; 120 120 # 120 # Start the installation 120 # 120 my $command = sprintf("\"%s\" /s /f1\"%s\"", $INPUT_DW, $scriptname); 120 120 if (Win32::Process::Create($installation, 120 $INPUT_DW, 120 $command, 120 0, 120 NORMAL_PRIORITY_CLASS, 120 dirname($INPUT_DW))) 120 { 120 print "The agent installation has been started.\n"; 120 } 120 else 120 { 120 printf "Cannot start agent installation: %s\n", 120 Win32::FormatMessage(Win32::GetLastError()); 120 unlink $scriptname; 120 } # # 121 #!/bin/ksh -ph 121 # 121 #{{SHELL_IRIX #!/usr/bin/ksh 121 #{{SHELL_LINUX #!/bin/sh 121 # 121 #+++++++++++++++++++++++++++ 121 # | 121 # UNIX Shell script. | 121 # | 121 #+++++++++++++++++++++++++++ 121 # 121 # 121 # 121 121 # 121 # Initial values from input 121 # 121 DIRECTORY="$INPUT_PU" 121 PACKAGE="$INPUT_DU" 121 KEY="$INPUT_KE" 121 KEYFLAG="-k" 121 121 # 121 # Create a temporary work folder in /tmp ... 121 # 121 mkdir /tmp/sysgem 121 cp $PACKAGE /tmp/sysgem 121 PACKAGE="/tmp/sysgem/`basename $PACKAGE`" 121 # Changed stuff end 121 121 # 121 # Select the right parameters if Installation Keys are used 121 # 121 if [ "$INPUT_KT" = "Installation Key" ] 121 then 121 KEYFLAG="-i" 121 KEY="${INPUT_AS}:${INPUT_KE}" 121 fi 121 121 # 121 # If directory wasn't specified (user-supplied data), find it from 121 # package path -- the File Copy dialog does this for us. 121 # 121 if [ -z "$DIRECTORY" ] 121 then 121 DIRECTORY="`dirname $PACKAGE`" 121 fi 121 121 # 121 # Check that the package file exists, unpack it, and check contents 121 # 121 if ! [ -r "$PACKAGE" ] 121 then 121 echo "Agent package not found at $PACKAGE" 121 exit 121 fi 121 121 #set -x 121 121 ( cd "$DIRECTORY" && tar xf "$PACKAGE" ) > /dev/null 2>/dev/null 121 121 if ! [ -x "$DIRECTORY/setup" ] 121 then 121 echo "Agent installation files not found in $DIRECTORY" 121 exit 121 fi 121 121 # 121 # Remove any existing logfile 121 # 121 LOGFILE="$INPUT_UI/setup.`hostname`.log" 121 [ -f "$LOGFILE" ] && rm "$LOGFILE" 121 121 # 121 # Schedule the job to run at the top of the current minute 121 # (if we start it here, the agent can't reply to the user!) 121 # 121 at now + 1 minute << EOF 121 cd "$DIRECTORY" 121 ./setup -d "$INPUT_UI" -p "$INPUT_PN" "$KEYFLAG" "$KEY" -a $INPUT_UA -s $INPUT_US -c 0 > "$LOGFILE" 121 cd / 121 rm -R /tmp/sysgem 121 EOF 121 121 echo "Agent will be upgraded in one minute." 121 echo "The logfile will be stored in $LOGFILE." # 122 $!+++++++++++++++++++++++++++++ 122 $! | 122 $! VMS command file (DCL). | 122 $! | 122 $!+++++++++++++++++++++++++++++ 122 $! 122 $! 122 $! Create derivations of input parameters for installation answers 122 $! 122 $! Key type / specification - security key is default: 122 $ DERIVE_KT = 1 122 $ DERIVE_KE = INPUT_KE 122 $ IF INPUT_KT .EQS. "Installation Key" 122 $ THEN 122 $ DERIVE_KT = 2 122 $ DERIVE_KE = INPUT_AS + ":" + INPUT_KE 122 $ ENDIF 122 $! 122 $! Autostart 122 $ DERIVE_VA = "YES" 122 $ IF INPUT_VA .EQ. 0 THEN DERIVE_VA = "NO" 122 $! 122 $! Start now 122 $ DERIVE_VS = "YES" 122 $ IF INPUT_VS .EQ. 0 THEN DERIVE_VS = "NO" 122 $! 122 $! Determine location and name of kit from input parameter 122 $! 122 $ KITDIR = F$PARSE(INPUT_DV, , , "NODE") - 122 + F$PARSE(INPUT_DV, , , "DEVICE") - 122 + F$PARSE(INPUT_DV, , , "DIRECTORY") 122 $ KITNAME = F$PARSE(INPUT_DV, , , "NAME") 122 $! 122 $! Make sure a file specification exists 122 $! 122 $ IF KITNAME .EQS. "" 122 $ THEN 122 $ WRITE SYS$OUTPUT "No installation saveset defined. Installation failed." 122 $ EXIT 122 $ ENDIF 122 $! 122 $! Make sure a file exists 122 $! 122 $ IF F$SEARCH("''INPUT_DV'") .EQS. "" 122 $ THEN 122 $ WRITE SYS$OUTPUT "Installation saveset cannot be found. Installation failed." 122 $ EXIT 122 $ ENDIF 122 $! 122 $! Generate the name of the answer file and batch job file 122 $! NB: VMSINSTAL documentation says the answer file is in SYS$UPDATE, 122 $! but using that logical creates it in SYS$SYSROOT -- VMSINSTAL 122 $! promptly creates a new answer file in SYS$SYSCOMMON! 122 $! 122 $ NODEAREA = F$GETSYI("NODE_AREA") 122 $ NODENUMBER = F$GETSYI("NODE_NUMBER") 122 $ ANSWERS = "SYS$COMMON:[SYSUPD]''KITNAME'.ANS" 122 $ ANSWERSWLD = "SYS$COMMON:[SYSUPD]''KITNAME'.ANS;*" 122 $ JOBNAME = "''KITDIR'UPGRADE-''NODEAREA'-''NODENUMBER'.COM" 122 $ JOBNAMEWLD = "''KITDIR'UPGRADE-''NODEAREA'-''NODENUMBER'.COM;*" 122 $ LOGNAME = "''KITDIR'UPGRADE-''NODEAREA'-''NODENUMBER'.LOG" 122 $! 122 $! Make sure they don't already exist to avoid clutter... 122 $! 122 $ IF F$SEARCH(ANSWERS) .NES. "" THEN DELETE "''ANSWERSWLD'" 122 $ IF F$SEARCH(JOBNAME) .NES. "" THEN DELETE "''JOBNAMEWLD'" 122 $! 122 $! Create the answer file 122 $! 122 $ WRITE SYS$OUTPUT "Creating Answer File" 122 $ OPEN/WRITE/ERROR=ANSWER_ERROR ANSWER_FILE 'ANSWERS' 122 $ WRITE/ERROR=ANSWER_ERROR_OPEN ANSWER_FILE "* Enter the device and directory [SYS$SYSROOT:[SYSGEM-SEM-AGENT]]: \''INPUT_VI'" 122 $ WRITE/ERROR=ANSWER_ERROR_OPEN ANSWER_FILE "* Please select a key type from the list above [1]: \''DERIVE_KT'" 122 $ WRITE/ERROR=ANSWER_ERROR_OPEN ANSWER_FILE "* Enter the security key: \''DERIVE_KE'" 122 $ WRITE/ERROR=ANSWER_ERROR_OPEN ANSWER_FILE "* Enter YES or NO [YES]? \''DERIVE_VA'" 122 $ WRITE/ERROR=ANSWER_ERROR_OPEN ANSWER_FILE "* Start the agent now ? [YES]? \''DERIVE_VS'" 122 $ CLOSE ANSWER_FILE 122 $! 122 $! Create the batch file to start the job 122 $! 122 $ WRITE SYS$OUTPUT "Creating Batch Job" 122 $ OPEN/WRITE/ERROR=JOB_ERROR JOB_FILE 'JOBNAME' 122 $ WRITE/ERROR=JOB_ERROR_OPEN JOB_FILE "$ SET NOVERIFY" 122 $ WRITE/ERROR=JOB_ERROR_OPEN JOB_FILE "$ SET DEFAULT ''KITDIR'" 122 $ WRITE/ERROR=JOB_ERROR_OPEN JOB_FILE "$ @SYS$UPDATE:VMSINSTAL ''KITNAME' ''KITDIR' OPTIONS AI" 122 $ WRITE/ERROR=JOB_ERROR_OPEN JOB_FILE "$ DELETE ''ANSWERSWLD'" 122 $ CLOSE JOB_FILE 122 $! 122 $! Queue the job 122 $! 122 $ WRITE SYS$OUTPUT "Submitting Batch Job" 122 $ SUBMIT /AFTER="+:01" /LOG_FILE='LOGNAME' /KEEP /NOPRINTER /NOTE="Sysgem SEM Agent upgrade" 'JOBNAME' 122 $ WRITE SYS$OUTPUT "Agent upgrade will take place in 1 minute." 122 $ WRITE SYS$OUTPUT "The installation log will be left at ''LOGNAME'" 122 $ EXIT 122 $! 122 $ ANSWER_ERROR_OPEN: 122 $ CLOSE ANSWER_FILE 122 $ ANSWER_ERROR: 122 $ ERRTEXT = F$MESSAGE($STATUS) 122 $ WRITE SYS$OUTPUT "Could not create answer file ''ANSWERS':" 122 $ WRITE SYS$OUTPUT ERRTEXT 122 $ EXIT 122 $! 122 $ JOB_ERROR_OPEN: 122 $ CLOSE JOB_FILE 122 $ JOB_ERROR: 122 $ ERRTEXT = F$MESSAGE($STATUS) 122 $ WRITE SYS$OUTPUT "Could not create batch job file ''JOBNAME':" 122 $ WRITE SYS$OUTPUT ERRTEXT 122 $ EXIT # 145 144 141 146 142 143 130 ** 131 ~f~oSpecify the general agent configuration that applies to all platforms here. 132 133 4 134 135 0 136 137 Global 138 16777215 139 150 151 000 152 153 0 154 0 156 2 157 1 & # 130 ZA 131 132 133 4 134 135 0 136 137 Global 138 16777215 139 150 151 000 152 153 0 154 0 156 2 157 1 & # 130 PN 131 Port number: 132 133 0 134 135 17 136 137 Global 138 16777215 139 7251 150 151 000 152 153 0 154 0 156 1 157 1 & # 130 XA 131 (Port number is ignored for OpenVMS) 132 133 4 134 135 0 136 137 Global 138 16777215 139 150 151 000 152 153 0 154 1 156 1 157 1 & # 130 KT 131 Key type: 132 Security Key\Installation Key 133 3 134 135 0 136 137 Global 138 16777215 139 150 151 000 152 153 0 154 0 156 1 157 1 & # 130 AS 131 Authorization Server: 132 133 0 134 135 8 136 137 Global 138 16777215 139 150 151 000KTInstallation Key 152 153 0 154 1 156 1 157 1 & # 130 KE 131 Key: 132 133 0 134 135 1 136 137 Global 138 16777215 139 150 151 000 152 153 0 154 0 156 2 157 1 & # 130 ** 131 ~f~oSpecify options that are specific to Unix agents here. 132 133 4 134 135 0 136 137 Unix 138 16777215 139 150 151 000 152 153 0 154 0 156 2 157 1 & # 130 ZB 131 132 133 4 134 135 0 136 137 Unix 138 16777215 139 150 151 000 152 153 0 154 0 156 2 157 1 & # 130 DU 131 Unix kit file: 132 133 0 134 135 0 136 137 Unix 138 16777215 139 150 151 000 152 153 0 154 0 156 2 157 1 & # 130 UI 131 Install to: 132 133 0 134 135 0 136 137 Unix 138 16777215 139 /opt/Sysgem/SEM 150 151 000 152 153 0 154 0 156 2 157 1 & # 130 UA 131 Autostart? 132 133 1 134 135 0 136 137 Unix 138 16777215 139 1 150 151 000 152 153 0 154 0 156 1 157 1 & # 130 US 131 Start now? 132 133 1 134 135 0 136 137 Unix 138 16777215 139 1 150 151 000 152 153 0 154 1 156 1 157 1 & # 130 ** 131 ~f~oSpecify options that are specific to Windows agents here. 132 133 4 134 135 0 136 137 Windows 138 16777215 139 150 151 000 152 153 0 154 0 156 2 157 1 & # 130 ZC 131 132 133 4 134 135 0 136 137 Windows 138 16777215 139 150 151 000 152 153 0 154 0 156 2 157 1 & # 130 DW 131 Windows kit file: 132 133 0 134 135 0 136 137 Windows 138 16777215 139 150 151 000 152 153 0 154 0 156 2 157 1 & # 130 WI 131 Install to: 132 133 0 134 135 0 136 137 Windows 138 16777215 139 %PROGRAMFILES%\Sysgem 150 151 000 152 153 0 154 0 156 2 157 1 & # 130 WT 131 Agent account: 132 Local System\Custom 133 3 134 135 0 136 137 Windows 138 16777215 139 150 151 000 152 153 0 154 0 156 1 157 1 & # 130 XB 131 132 133 4 134 135 0 136 137 Windows 138 16777215 139 150 151 000 152 153 0 154 1 156 1 157 1 & # 130 WU 131 Username: 132 133 0 134 135 0 136 137 Windows 138 16777215 139 150 151 000WTCustom 152 153 0 154 0 156 1 157 1 & # 130 WP 131 Password: 132 133 16 134 135 0 136 137 Windows 138 16777215 139 150 151 000WTCustom 152 153 0 154 1 156 1 157 1 & # 130 ** 131 ~f~oSpecify options that are specific to VMS agents here. 132 133 4 134 135 0 136 137 VMS 138 16777215 139 150 151 000 152 153 0 154 0 156 2 157 1 & # 130 ZD 131 132 133 4 134 135 0 136 137 VMS 138 16777215 139 150 151 000 152 153 0 154 0 156 2 157 1 & # 130 DV 131 VMS kit file: 132 133 0 134 135 0 136 137 VMS 138 16777215 139 150 151 000 152 153 0 154 0 156 2 157 1 & # 130 VI 131 Install to: 132 133 0 134 135 0 136 137 VMS 138 16777215 139 SYS$SYSROOT:[SYSGEM-SEM-AGENT] 150 151 000 152 153 0 154 0 156 2 157 1 & # 130 VA 131 Autostart? 132 133 1 134 135 0 136 137 VMS 138 16777215 139 1 150 151 000 152 153 0 154 0 156 1 157 1 & # 130 VS 131 Start now? 132 133 1 134 135 0 136 137 VMS 138 16777215 139 1 150 151 000 152 153 0 154 1 156 1 157 1 & # @ # 100 UnZip VMS Saveset 102 Upgrade Support Tasks # 101 Unzips the SEM Agent for VMS distribution zip file, to simplify the setting of attributes prior to unattended agent upgrades. 101 101 Before starting this script, an UNZIP.EXE program suitable for the target system (VAX, AXP or IA64) must be present in the same directory as the distribution zip file. 101 101 Created 2009-09-30 14:03:56 by mikeschofield # # 124 /*****************************/ 124 /* */ 124 /* CL Program */ 124 /* */ 124 /*****************************/ 124 # # 120 #++++++++++++++++++++++++++++++++++ 120 # | 120 # Windows NT script (PERL). | 120 # | 120 #++++++++++++++++++++++++++++++++++ 120 # 120 # # # 121 #!/bin/ksh -ph 121 # 121 #{{SHELL_IRIX #!/usr/bin/ksh 121 #{{SHELL_LINUX #!/bin/sh 121 # 121 #+++++++++++++++++++++++++++ 121 # | 121 # UNIX Shell script. | 121 # | 121 #+++++++++++++++++++++++++++ 121 # 121 # 121 # # 122 $!+++++++++++++++++++++++++++++ 122 $! | 122 $! VMS command file (DCL). | 122 $! | 122 $!+++++++++++++++++++++++++++++ 122 $! 122 $! 122 $! 122 $! 122 $! Determine location and name of kit from input parameter 122 $! 122 $ KITDIR = F$PARSE(INPUT_DZ, , , "NODE") - 122 + F$PARSE(INPUT_DZ, , , "DEVICE") - 122 + F$PARSE(INPUT_DZ, , , "DIRECTORY") 122 $ KITNAME = F$PARSE(INPUT_DZ, , , "NAME") 122 $! 122 $! Make sure a file specification exists 122 $! 122 $ IF KITNAME .EQS. "" 122 $ THEN 122 $ WRITE SYS$OUTPUT "No ZIP archive defined. Unzip failed." 122 $ EXIT 122 $ ENDIF 122 $! 122 $! Make sure a file exists 122 $! 122 $ IF F$SEARCH("''INPUT_DZ'") .EQS. "" 122 $ THEN 122 $ WRITE SYS$OUTPUT "ZIP archive cannot be found. Unzip failed." 122 $ EXIT 122 $ ENDIF 122 $! 122 $! Make sure a the unzip exe is in the same directory 122 $! 122 $ UNZIPFILE = "''KITDIR'UNZIP.EXE" 122 $ UNZIP = "$''KITDIR'UNZIP.EXE" 122 $ IF F$SEARCH("''UNZIPFILE'") .EQS. "" 122 $ THEN 122 $ WRITE SYS$OUTPUT "Error - UNZIP.EXE cannot be found in: ''KITDIR'." 122 $ WRITE SYS$OUTPUT " Copy UNZIP.EXE into: ''KITDIR'." 122 $ EXIT 122 $ ENDIF 122 $! 122 $ set def 'KITDIR' 122 $ set verify 122 $ UNZIP 'INPUT_DZ' 122 $ set noverify 122 $! 122 $ write sys$output "archive unzipped" 122 $ dir /exclude=(*.zip,unzip.exe) 122 $ EXIT # 145 144 141 146 142 143 130 DZ 131 VMS Kit Archive 132 133 0 134 135 0 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # @ # 100 Upgrade Agent 102 Upgrade Support Tasks # 101 Perform an unattended upgrade of the SEM agent on one or more target Windows, OpenVMS or Unix agents. 101 101 This version of the script does not use the Task features introduced in version 2.3 of the SEM GUI; if you are running build 4286 or newer, the 'Upgrade Agent (for v2.3 GUIs)' task provides a more organised interface to the required parameters. 101 101 Before starting the upgrade, the relevant agent installation kits will need to be placed in a location accessible by the currently-installed SEM agent. If a shared directory is not available for this purpose, the SEM File and Directory Explorer can be used to copy the agent kit to the target systems and then automatically run this Task to perform the upgrade. 101 101 For more details on unattended upgrades of the SEM system, please contact Sysgem at support@sysgem.com. 101 101 Created 2009-07-08 10:51:27 by baljemmett 101 101 Last update: 101 Modified 2009-09-25 17:54:26 by baljemmett # # 124 /*****************************/ 124 /* */ 124 /* CL Program */ 124 /* */ 124 /*****************************/ 124 # # 120 #++++++++++++++++++++++++++++++++++ 120 # | 120 # Windows NT script (PERL). | 120 # | 120 #++++++++++++++++++++++++++++++++++ 120 # 120 # 120 120 use Win32::Process; 120 use Win32::Registry; 120 use File::Basename; 120 120 # 120 # Routine to obscure passwords in the installation response file 120 # 120 sub Encode($) 120 { 120 my @key = split //, "Sysgem"; 120 my $input = $_[0]; 120 my $output = ""; 120 my $idx = 0; 120 120 for (split //, $input) 120 { 120 $output .= sprintf("%02.2x", ord($_) ^ ord($key[$idx++ % @key])); 120 } 120 120 $output; 120 } 120 120 # 120 # Build response file to feed InstallShield 120 # 120 my $DERIVE_UN = "Registered User"; 120 my $DERIVE_CO = "Registered Company"; 120 my $DERIVE_WP = Encode($INPUT_WP); 120 my $DERIVE_LS = $INPUT_WT eq "Local System" ? 1 : 0; 120 my $DERIVE_CU = $INPUT_WT ne "Local System" ? 1 : 0; 120 my $DERIVE_ST = $INPUT_KT eq "Installation Key" ? 2 : 1; 120 my $DERIVE_KE = Encode($INPUT_KE); 120 120 my $KEYDIALOG = $INPUT_KT eq "Installation Key" ? "SdShowDlgEdit3" : "DlgGetSecurityKeyEx"; 120 120 # 120 # Dig out some values from the Registry 120 # 120 if ($HKEY_LOCAL_MACHINE->Open("SOFTWARE\\SYSGEM\\Installation", $hKeyInstallation)) 120 { 120 my $type, $value1, $value2; 120 $hKeyInstallation->QueryValueEx("User Name", $type, $value1) and $DERIVE_UN = $value1; 120 $hKeyInstallation->QueryValueEx("Company Name", $type, $value2) and $DERIVE_CO = $value2; 120 $hKeyInstallation->Close(); 120 } 120 120 # 120 # Expand out environment variables in install dir 120 # 120 $INPUT_WI =~ s/%([^% ]+)%/$ENV{$1}/eg; 120 120 # 120 # InstallShield appears to prefer ' ' to an empty entry 120 # 120 $DERIVE_UN = "' '" if $DERIVE_UN eq ""; 120 $DERIVE_CO = "' '" if $DERIVE_CO eq ""; 120 $DERIVE_WP = "' '" if $DERIVE_WP eq ""; 120 $DERIVE_KE = "' '" if $DERIVE_KE eq ""; 120 $INPUT_WI = "' '" if $INPUT_WI eq ""; 120 $INPUT_WU = "' '" if $INPUT_WU eq ""; 120 $INPUT_PN = "' '" if $INPUT_PN eq ""; 120 $INPUT_AS = "' '" if $INPUT_AS eq ""; 120 $INPUT_KE = "' '" if $INPUT_KE eq ""; 120 120 my $script = < $scriptname")) 120 { 120 print "Cannot create unattended response file: $!\n"; 120 exit; 120 } 120 120 print SCRIPT $script; 120 close SCRIPT; 120 120 # 120 # Start the installation 120 # 120 my $command = sprintf("\"%s\" /s /f1\"%s\"", $INPUT_DW, $scriptname); 120 120 if (Win32::Process::Create($installation, 120 $INPUT_DW, 120 $command, 120 0, 120 NORMAL_PRIORITY_CLASS, 120 dirname($INPUT_DW))) 120 { 120 print "The agent installation has been started.\n"; 120 } 120 else 120 { 120 printf "Cannot start agent installation: %s\n", 120 Win32::FormatMessage(Win32::GetLastError()); 120 unlink $scriptname; 120 } # # 121 #!/bin/ksh -ph 121 # 121 #{{SHELL_IRIX #!/usr/bin/ksh 121 #{{SHELL_LINUX #!/bin/sh 121 # 121 #+++++++++++++++++++++++++++ 121 # | 121 # UNIX Shell script. | 121 # | 121 #+++++++++++++++++++++++++++ 121 # 121 # 121 # 121 121 # 121 # Initial values from input 121 # 121 DIRECTORY="$INPUT_PU" 121 PACKAGE="$INPUT_DU" 121 KEY="$INPUT_KE" 121 KEYFLAG="-k" 121 121 # 121 # Select the right parameters if Installation Keys are used 121 # 121 if [ "$INPUT_KT" = "Installation Key" ] 121 then 121 KEYFLAG="-i" 121 KEY="${INPUT_AS}:${INPUT_KE}" 121 fi 121 121 # 121 # If directory wasn't specified (user-supplied data), find it from 121 # package path -- the File Copy dialog does this for us. 121 # 121 if [ -z "$DIRECTORY" ] 121 then 121 DIRECTORY="`dirname $PACKAGE`" 121 fi 121 121 # 121 # Check that the package file exists, unpack it, and check contents 121 # 121 if ! [ -r "$PACKAGE" ] 121 then 121 echo "Agent package not found at $PACKAGE" 121 exit 121 fi 121 121 ( cd "$DIRECTORY" && tar xf "$PACKAGE" ) > /dev/null 2>/dev/null 121 121 if ! [ -x "$DIRECTORY/setup" ] 121 then 121 echo "Agent installation files not found in $DIRECTORY" 121 exit 121 fi 121 121 # 121 # Remove any existing logfile 121 # 121 LOGFILE="$DIRECTORY/setup.`hostname`.log" 121 [ -f "$LOGFILE" ] && rm "$LOGFILE" 121 121 # 121 # Schedule the job to run at the top of the current minute 121 # (if we start it here, the agent can't reply to the user!) 121 # 121 at now + 1 minute << EOF 121 cd "$DIRECTORY" 121 ./setup -d "$INPUT_UI" -p "$INPUT_PN" "$KEYFLAG" "$KEY" -a $INPUT_UA -s $INPUT_US -c 0 > "$LOGFILE" 121 EOF 121 121 echo "Agent will be upgraded in one minute." 121 echo "The logfile will be stored in $LOGFILE." # 122 $!+++++++++++++++++++++++++++++ 122 $! | 122 $! VMS command file (DCL). | 122 $! | 122 $!+++++++++++++++++++++++++++++ 122 $! 122 $! 122 $! Create derivations of input parameters for installation answers 122 $! 122 $! Key type / specification - security key is default: 122 $ DERIVE_KT = 1 122 $ DERIVE_KE = INPUT_KE 122 $ IF INPUT_KT .EQS. "Installation Key" 122 $ THEN 122 $ DERIVE_KT = 2 122 $ DERIVE_KE = INPUT_AS + ":" + INPUT_KE 122 $ ENDIF 122 $! 122 $! Autostart 122 $ DERIVE_VA = "YES" 122 $ IF INPUT_VA .EQ. 0 THEN DERIVE_VA = "NO" 122 $! 122 $! Start now 122 $ DERIVE_VS = "YES" 122 $ IF INPUT_VS .EQ. 0 THEN DERIVE_VS = "NO" 122 $! 122 $! Determine location and name of kit from input parameter 122 $! 122 $ KITDIR = F$PARSE(INPUT_DV, , , "NODE") - 122 + F$PARSE(INPUT_DV, , , "DEVICE") - 122 + F$PARSE(INPUT_DV, , , "DIRECTORY") 122 $ KITNAME = F$PARSE(INPUT_DV, , , "NAME") 122 $! 122 $! Make sure a file specification exists 122 $! 122 $ IF KITNAME .EQS. "" 122 $ THEN 122 $ WRITE SYS$OUTPUT "No installation saveset defined. Installation failed." 122 $ EXIT 122 $ ENDIF 122 $! 122 $! Make sure a file exists 122 $! 122 $ IF F$SEARCH("''INPUT_DV'") .EQS. "" 122 $ THEN 122 $ WRITE SYS$OUTPUT "Installation saveset cannot be found. Installation failed." 122 $ EXIT 122 $ ENDIF 122 $! 122 $! Generate the name of the answer file and batch job file 122 $! NB: VMSINSTAL documentation says the answer file is in SYS$UPDATE, 122 $! but using that logical creates it in SYS$SYSROOT -- VMSINSTAL 122 $! promptly creates a new answer file in SYS$SYSCOMMON! 122 $! 122 $ NODEAREA = F$GETSYI("NODE_AREA") 122 $ NODENUMBER = F$GETSYI("NODE_NUMBER") 122 $ ANSWERS = "SYS$COMMON:[SYSUPD]''KITNAME'.ANS" 122 $ ANSWERSWLD = "SYS$COMMON:[SYSUPD]''KITNAME'.ANS;*" 122 $ JOBNAME = "''KITDIR'UPGRADE-''NODEAREA'-''NODENUMBER'.COM" 122 $ JOBNAMEWLD = "''KITDIR'UPGRADE-''NODEAREA'-''NODENUMBER'.COM;*" 122 $ LOGNAME = "''KITDIR'UPGRADE-''NODEAREA'-''NODENUMBER'.LOG" 122 $! 122 $! Make sure they don't already exist to avoid clutter... 122 $! 122 $ IF F$SEARCH(ANSWERS) .NES. "" THEN DELETE "''ANSWERSWLD'" 122 $ IF F$SEARCH(JOBNAME) .NES. "" THEN DELETE "''JOBNAMEWLD'" 122 $! 122 $! Create the answer file 122 $! 122 $ WRITE SYS$OUTPUT "Creating Answer File" 122 $ OPEN/WRITE/ERROR=ANSWER_ERROR ANSWER_FILE 'ANSWERS' 122 $ WRITE/ERROR=ANSWER_ERROR_OPEN ANSWER_FILE "* Enter the device and directory [SYS$SYSROOT:[SYSGEM-SEM-AGENT]]: \''INPUT_VI'" 122 $ WRITE/ERROR=ANSWER_ERROR_OPEN ANSWER_FILE "* Please select a key type from the list above [1]: \''DERIVE_KT'" 122 $ WRITE/ERROR=ANSWER_ERROR_OPEN ANSWER_FILE "* Enter the security key: \''DERIVE_KE'" 122 $ WRITE/ERROR=ANSWER_ERROR_OPEN ANSWER_FILE "* Enter YES or NO [YES]? \''DERIVE_VA'" 122 $ WRITE/ERROR=ANSWER_ERROR_OPEN ANSWER_FILE "* Start the agent now ? [YES]? \''DERIVE_VS'" 122 $ CLOSE ANSWER_FILE 122 $! 122 $! Create the batch file to start the job 122 $! 122 $ WRITE SYS$OUTPUT "Creating Batch Job" 122 $ OPEN/WRITE/ERROR=JOB_ERROR JOB_FILE 'JOBNAME' 122 $ WRITE/ERROR=JOB_ERROR_OPEN JOB_FILE "$ SET NOVERIFY" 122 $ WRITE/ERROR=JOB_ERROR_OPEN JOB_FILE "$ SET DEFAULT ''KITDIR'" 122 $ WRITE/ERROR=JOB_ERROR_OPEN JOB_FILE "$ @SYS$UPDATE:VMSINSTAL ''KITNAME' ''KITDIR' OPTIONS AI" 122 $ WRITE/ERROR=JOB_ERROR_OPEN JOB_FILE "$ DELETE ''ANSWERSWLD'" 122 $ CLOSE JOB_FILE 122 $! 122 $! Queue the job 122 $! 122 $ WRITE SYS$OUTPUT "Submitting Batch Job" 122 $ SUBMIT /AFTER="+:01" /LOG_FILE='LOGNAME' /KEEP /NOPRINTER /NOTE="Sysgem SEM Agent upgrade" 'JOBNAME' 122 $ WRITE SYS$OUTPUT "Agent upgrade will take place in 1 minute." 122 $ WRITE SYS$OUTPUT "The installation log will be left at ''LOGNAME'" 122 $ EXIT 122 $! 122 $ ANSWER_ERROR_OPEN: 122 $ CLOSE ANSWER_FILE 122 $ ANSWER_ERROR: 122 $ ERRTEXT = F$MESSAGE($STATUS) 122 $ WRITE SYS$OUTPUT "Could not create answer file ''ANSWERS':" 122 $ WRITE SYS$OUTPUT ERRTEXT 122 $ EXIT 122 $! 122 $ JOB_ERROR_OPEN: 122 $ CLOSE JOB_FILE 122 $ JOB_ERROR: 122 $ ERRTEXT = F$MESSAGE($STATUS) 122 $ WRITE SYS$OUTPUT "Could not create batch job file ''JOBNAME':" 122 $ WRITE SYS$OUTPUT ERRTEXT 122 $ EXIT # 145 144 141 146 142 143 130 ZA 131 ~f~o~bGeneral options: 132 133 4 134 135 0 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # 130 PN 131 Port number: 132 133 0 134 135 17 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # 130 XA 131 (Port number is ignored for OpenVMS) 132 133 4 134 135 0 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # 130 KT 131 Key type: 132 Security Key\Installation Key 133 3 134 135 0 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # 130 AS 131 Authorization Server: 132 133 0 134 135 8 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # 130 KE 131 Key: 132 133 0 134 135 1 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # 130 XB 131 132 133 4 134 135 0 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # 130 ZB 131 ~f~o~bUnix options: 132 133 4 134 135 0 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # 130 DU 131 Unix kit file: 132 133 0 134 135 0 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # 130 UI 131 Install to: 132 133 0 134 135 0 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # 130 UA 131 Autostart? 132 133 1 134 135 0 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # 130 US 131 Start now? 132 133 1 134 135 0 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # 130 XC 131 132 133 4 134 135 0 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # 130 ZC 131 ~f~o~bWindows options: 132 133 4 134 135 0 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # 130 DW 131 Windows kit file: 132 133 0 134 135 0 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # 130 WI 131 Install to: 132 133 0 134 135 0 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # 130 WT 131 Agent account: 132 Local System\Custom 133 3 134 135 0 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # 130 WU 131 Username: 132 133 0 134 135 0 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # 130 WP 131 Password: 132 133 16 134 135 0 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # 130 XD 131 132 133 4 134 135 0 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # 130 ZD 131 ~f~o~bVMS options: 132 133 4 134 135 0 136 137 138 16777215 139 150 151 000 152 153 0 154 0 156 1 157 1 & # 130 DV 131 VMS kit file: 132 133 0 134 135 0 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # 130 VI 131 Install to: 132 133 0 134 135 0 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # 130 VA 131 Autostart? 132 133 1 134 135 0 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # 130 VS 131 Start now? 132 133 1 134 135 0 136 137 138 16777215 139 150 151 152 153 0 154 0 156 1 157 1 & # @ # # # License Information. # #{{PRODUCT:Tasks #{{CREATED_BY:Sysgem AG,Zurich,8008,Switzerland # # Checksum. # #{{CHECKSUM:7519-0AD8-0039-DCB3-8147-A25C-7BDA-CB5F