Programming4us
         
 
 
Applications Server

Microsoft Systems Management Server 2003 : Modifying Installation Scripts Using Script Editor (part 2) - Modifying the Script, Windows Installer Step-Up Utility Buttons

6/21/2012 4:53:33 PM

Modifying the Script

Now let’s take a look at how to make some simple modifications to our script using Script Editor. To do so, follow these steps:

1.
In the Installation Expert interface, choose Script Editor from the View menu to display the Script Editor interface, shown previously in Figure 1.

2.
Choose Open from the File menu to display the Open dialog box, shown in Figure 3, and then select a script (.IPF) file to open for editing. For this example, we’ll use the script we created earlier. Click Open to open the script for editing.

Figure 3. The Open dialog box.


3.
Next we’ll edit the variable that specifies the installation directory the program will use. In this example we’re installing to the Microsoft TechNet directory. We’ll change this to TechNet.

Choose Find from the Edit menu to display the Find Text In Installation Script dialog box, shown in Figure 4. Enter Maindir in the Find What text box, and then click Find Next. The first instance of a script line containing “Maindir” is selected. This is the variable setting for the directory location of the Office installation we want to modify. Click Close to close the dialog box.

Figure 4. The Find Text In Installation Script dialog box.


4.
Click Edit Script Item button on Installation toolbar or double-click the Set Variable statement containing “Maindir” to display the Set Variable dialog box, shown in Figure 5. In the New Value text box, enter TechNet and then click OK. The variable setting is modified in the Installation Script pane of the Script Editor interface.

Figure 5. The Set Variable dialog box.


You’d accomplish any additional script modifications in much the same manner. After we’ve completed our editing of the script, we’re ready to test and compile the installation script file. This will give us the SMS Installer–generated executable file.

Windows Installer Step-Up Utility Buttons

The Script Editor also offers three buttons that you can use to assist you in creating and testing Windows Installer packages. These are the three buttons at the far right of the toolbar in the Script Editor interface as seen previously in Figure 1. They are (in order from left to right as seen in the Script Editor window):

  • Compile As Windows Installer Package Lets you create a new Windows Installer package or convert an existing SMS Installer package to a Windows Installer package.

  • Run As Windows Installer Package Lets you run the Windows Installer package you create on the reference computer exactly as it would run on the target computers.

  • Uninstall Windows Installer Package Lets you remove a Windows Installer package that you installed on the reference computer using the Run As Windows Installer Package button.

The use of these buttons is fairly straightforward. You need to have opened or created an SMS Installer or Windows Installer script—an .IPF file. Then click the appropriate button to carry out the task. A command-line version of the Windows Installer Step-Up Utility is also included when you install SMS Installer on the reference computer. Selecting the option ISU Command-Line Utility in the Microsoft SMS Installer program group displays a command prompt window, shown in Figure 6, that lists the command-line options that are available and the command syntax, and that places the command prompt in the appropriate directory to run the utility. You can also refer to the SMS Installer Help for detailed instructions for using the Windows Installer Step-Up Utility.

Figure 6. Windows Installer Step-Up Utility command prompt window.

Real World: Sample Script

Occasionally you might encounter a situation in which you don’t want to install an application or run the installation script if certain elements aren’t in place on the target computer. For example, you might want to verify that there’s enough disk space available before proceeding or that a particular program file exists. This example uses a file to indicate whether a computer should execute the installation script. This is a simple text file that you create and copy to all the computers that shouldn’t execute the script. If the file is found on the computer, the script will be terminated. If the file isn’t found, the script will continue.

The sample SMS Installer script routine shown in Figure 7 demonstrates how to test for the existence of a file, and you can incorporate it into larger scripts. It provides a basic structure that you can easily modify to meet other needs.

Figure 7. Sample SMS Installer script designed to find a file and perform an action.

This script is designed to look for a specific file identified in the script as Findfile.txt using the Search For File action. In the Actions list, doubleclick Search For File to display the Search For File Settings dialog box, shown in Figure 8.

Figure 8. The Search For File Settings dialog box.


In the Search For File Settings dialog box, specify the file and path to search for and whether to search all local drives, all network drives, or both. The path that’s searched is determined by the Search Depth value. A value of 0 indicates that the entire drive will be searched. A value of 1 indicates that the root drive will be searched. Values of 2, 3, and higher indicate that the first directory level, second directory level, and so on will be searched. In this example we’ll search all local drives.

Select the Remove Filename check box. If the file is found, the file and its path will be stored in the variable FINDFILE. This option will remove the file entry and keep just the path, which can be useful if you’re trying to capture a specific path or need to rename a file, as we do in this script.

The script begins by using Set Variable to define a variable named FINDFILE. This variable is set to a default value of None to indicate that no file has been found. The Search For File action looks for the file on all local drives on the target computer. If the file is found, the file and its full path are placed in FINDFILE, and the value of FINDFILE is no longer None. Simple IF/THEN logic tests to determine whether FINDFILE is still None. If it’s not, the file has been found, and we’ll rename it Findfile.old. If the file hasn’t been found, we simply continue on with the rest of the script. The script also includes display messages for debugging purposes to alert us when the file has been found. You can remove these messages after the existence of the file has been tested.

You can easily modify this basic script routine to perform any number of actions or tasks—for example, deleting the file, moving the file to a new location, or creating a new file with the same name as an existing file if that file isn’t found.

Other -----------------
- Microsoft Systems Management Server 2003 : Modifying Installation Scripts Using Script Editor (part 1) - Script Editor Variables and Actions
- System Center Configuration Manager 2007 : Architecture Design Planning - Site Planning
- System Center Configuration Manager 2007 : Hierarchy Planning
- Microsoft Systems Management Server 2003 : Modifying Installation Scripts Using the Installation Expert (part 2)
- Microsoft Systems Management Server 2003 : Modifying Installation Scripts Using the Installation Expert (part 1)
- Sizing Considerations for mySAP Components (part 2) - Sizing mySAP Business Intelligence & Sizing mySAP SRM
- Sizing Considerations for mySAP Components (part 1) - The SAP Exchange Infrastructure
- Active Directory Domain Services 2008 : Transfer the Infrastructure Master Role
- Active Directory Domain Services 2008 : Transfer the PDC Emulator Role
- SAP Hardware, OS, and Database Sizing
 
 
Most View
- Windows 7 : Working with Network Files Offline (part 1) - Activating the Offline Files Feature & Making a File or Folder Available for Offline Use
- Windows Phone 7 : Connecting a Bluetooth Headset
- SQL Server 2008: Administering Database Objects - Working with Tables (part 2) - Primary Key Constraints & Unique Constraints
- SharePoint 2010 : Word Automation Services - Demonstration Scenario (part 3) - Combine Documents Using OpenXML, Converting an OpenXML Document to an Alternative Format
- Windows 7 : Setting Security Permissions on Files and Folders (part 4) - Assigning Standard Permissions
- Exchange Server 2003 : Creating and Managing Address Lists and Recipient Policies (part 3) - Working with Offline Address Lists & Creating and Applying Recipient Policies
- Sharepoint 2007 : Track the Progress of a Workflow
- SharePoint 2007 : Create an Alert on a List or a Library
- SQL Azure : Azure Server Administration (part 2) - Firewall Settings
- SQL Server 2012 : SQL Server Architecture - SQL SERVER’S EXECUTION MODEL AND THE SQLOS
Top 10
- Implementing Edge Services for an Exchange Server 2007 Environment : Utilizing the Basic Sender and Recipient Connection Filters (part 3) - Configuring Recipient Filtering
- Implementing Edge Services for an Exchange Server 2007 Environment : Utilizing the Basic Sender and Recipient Connection Filters (part 2)
- Implementing Edge Services for an Exchange Server 2007 Environment : Utilizing the Basic Sender and Recipient Connection Filters (part 1)
- Implementing Edge Services for an Exchange Server 2007 Environment : Installing and Configuring the Edge Transport Server Components
- What's New in SharePoint 2013 (part 7) - BCS
- What's New in SharePoint 2013 (part 6) - SEARCH
- What's New in SharePoint 2013 (part 6) - WEB CONTENT MANAGEMENT
- What's New in SharePoint 2013 (part 5) - ENTERPRISE CONTENT MANAGEMENT
- What's New in SharePoint 2013 (part 4) - WORKFLOWS
- What's New in SharePoint 2013 (part 3) - REMOTE EVENTS