SmartCloud+ tip: Install IIS on Windows with TSAM and Cygwin

Try this method if prerequisite services in the operating system won't start

Discover an alternative method of autostarting the prerequisite services required for unattended installation. This article shows how to use Cygwin and IBM® Tivoli® Service Automation Manager (TSAM) to install Internet Information Services (IIS) Windows® 2003 Server Version 6.

Bhanu P Tholeti (btholeti@in.ibm.com), Systems Engineer and Architect, IBM

Bhanuprakash has worked in the software industry for the past 10 years on various technologies and products such as application development for Pocket PCs, web-based applications, video streaming solutions, and products like Tivoli Workload Scheduler, WebSphere Data Interchange, Tivoli Service Automation Manager, and Tivoli Provisioning Manager. He is part of IBM SmartCloud Enterprise+, working on cloud infrastructures and hypervisors.



K. Sowjanya Chakravarthi (csowjany@in.ibm.com), Systems Engineer, IBM

Sowjanya CK has worked in IBM for more than 6 years on various products. He is involved in porting of Tivoli Provisioning Manager to z/Linux, Go Symphony plugin development, and SCEplus development.



24 January 2013

Also available in Chinese

You may encounter a few potential problems while trying to install software on IBM® SmartCloud™ Enterprise+. With that in mind, consider this alternative installation method that uses Internet Information Services Version 6 as an example.

The environment for this article consists of:

  • Internet Information Services (IIS) V6 32-bit
  • Microsoft® Windows 2003/2008 Server as the virtual machine over WMware ESXBox
  • Cygwin (installed by default over the Windows VM)
  • SmartCloud Enterprise+
  • Rapid deployment Services (RDS)
  • Simple Package Installer (SPIN)
  • AIX®
  • Tivoli Service Automation Manager (along with Tivoli Process Automation Engine (TPAE), Tivoli Service Request Manager (TSRM) and Tivoli Provisioning Manager (TPM) installed
  • Windows 2003 or 2008 server as a Virtual Machine over vmware ESXBox
  • Cygwin installed by default over the windows VM

It's a typical cloud environment in which you have both a managing and managed environments; the installation occurs from the managing environment to the managed one (that is from Tivoli Service Automation Manager to the virtual machine).

The problem

The goal is to install a piece of software on IBM SmartCloud Enterprise+ running on a Windows operating system. The software installed for the purposes of illustrating this method is Internet Information Services Version 6. The Cygwin environment with SmartCloud-enabled Rapid Deployment Services and simple package installer technology are used to install IIS. If you're unfamiliar with these technologies, see the short refresher in the conclusion of this article.

A problem with the traditional installation occurs when the process won't start due to not being able to start some of the prerequisite services in the operating system. In this case, you might see IIS error messages in the installation log as shown in Listing 1.

Listing 1. IIS logs error messages that abort the installation process
v10\spinPackage\spin\tools\iis\iis_on_base.txt" failed with the below error message
[4/18/2012 14:24:21] OC_CLEANUP:Executing Postinstall for the WWW component...
[4/18/2012 14:24:21] OC_CLEANUP:Calling RunMofCompOnIISFiles
[4/18/2012 14:24:21] OC_CLEANUP:InetStartSerice():ServiceName=W3SVC unable to start
WARNING. Err=0x424.
[4/18/2012 14:24:22] OC_CLEANUP:!FAIL!
[4/18/2012 14:24:22] OC_CLEANUP:Postinstall of Component 'iis_www' FAILED
[4/18/2012 14:24:22] OC_CLEANUP:Executing Postinstall for the FTP component...
[4/18/2012 14:24:22] OC_CLEANUP:InetStartSerice():ServiceName=MSFTPSVC unable to start
WARNING. Err=0x424.
[4/18/2012 14:24:22] OC_CLEANUP:!FAIL!
[4/18/2012 14:24:22] OC_CLEANUP:Postinstall of Component 'iis_ftp' FAILED
[4/18/2012 14:24:22] OC_CLEANUP:ProcessSection.[OC_CLEANUP}.Start.
[4/18/2012 14:24:22] OC_CLEANUP:...ProcessEntry:100=5...
[4/18/2012 14:24:22] OC_CLEANUP:Calling ProcessSection:SNMP_W3SVC_chk_cleanup:Start.

The exact cause of the problem is not known, but the problem occurs because a few services, for example, MSFTPSVC and W3SVC are not available to the Installer to be started (they are often available only if the user logs into the operating system).


The traditional approach

By default, Tivoli Service Automation Manager uses an SSH-based connection to connect to the virtual machines. All the Windows virtual machines have Cygwin installed as default in SmartCloud Enterprise+, so Tivoli Service Automation Manager logs into the Windows VM using an SSH connection into the Cygwin environment. That enables all the operations to be performed over the Windows VM through Cygwin. The device.execute workflow of Tivoli Service Automation Manager is normally used to execute the command over the Cygwin shell. The shell invokes the command prompt of Windows to perform any of the Windows operations. All of the BAT files can be executed with cmd \c {command} from within the Cygwin shell.

The device.execute command can be used as shown:

cmdtlcmTmpDir = "cmd /C " + "\"" + "mkdir " + TempDir + "\""
Device.ExecuteCommand(DeviceID, cmdtlcmTmpDir, <null>, "default", "6000", "ignore",
 <null>, <null>, <null>)

DeviceID is the target virtual machine where the command needs to be executed.


The solution

This method is tailored for scripts in Tivoli Provisioning Manager or Tivoli Service Automation Manager. First, autostart the prerequisite services required for unattended installation (those pertaining to installing IIS V6 over a 32-bit Window 2003 server). This involves enabling the autologin feature in the Windows registry with a maximum allowed count of 1 and, if necessary, disabling the Windows legal notice caption and text that is prompted just before the login screen.

When you have a legal notice caption enabled in Windows, before the user logs into the system, the system prompts the user to say OK for the legal notice. This means that for an unattended install you have to enable autologin. However, this legal notice keeps autologin from working since it requires manual interaction (click OK). The autologin allows required services to be available for the installation, services that are not available if the login doesn't happen.

All the registry entries explained in Listing 1 can be edited in normal text files and can be executed in Cygwin with the default regedit.exe command available from within Cygwin.

Listing 2 shows the code snippet to register the update code in the registry.

Listing 2. Register update code in the registry
scriptlet(spinDirCygwin,decryptedPassword_Winformated) language=bash
 target=DCMQuery(/Server[@id = $DeviceID]) <<EOS
     
               mkdir -p spinDirCygwin        
               tee  $spinDirCygwin/autologon.bat<< _EOT1_     
(echo Windows Registry Editor Version 5.00 && echo
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp]
 && echo "fInheritAutoLogon"=dword:00000000
 && echo "fInheritAutoClient"=dword:00000001
 && echo "Username"="Administrator"
 && echo "Password"="$decryptedPassword_Winformated")
 > C:\\spin\\autologon.reg
_EOT1_
               chmod 755  $spinDirCygwin /autologon.*
               cd $spinDirCygwin 
               cmd /c autologon.bat
               chmod 755 autologon.reg
               regedit.exe /s autologon.reg

               tee  $spinDirCygwin/autologon2.bat<< _EOT1_     
(echo Windows Registry Editor Version 5.00 && echo
 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
 && echo "AutoAdminLogon"="1"
 && echo "DefaultUserName"="Administrator"
 && echo "DefaultPassword"="$decryptedPassword_Winformated")
  > C:\\spin\\autologon2.reg
_EOT1_
               chmod 755  $spinDirCygwin /autologon2.*
               cd $spinDirCygwin 
               cmd /c autologon2.bat
               chmod 755 autologon2.reg
               regedit.exe /s autologon2.reg

                  tee  $spinDirCygwin/LegalNoticeText.bat<< _EOT1_     
(echo Windows Registry Editor Version 5.00 && echo
 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
 && echo "LegalNoticeCaption"=""
 && echo "LegalNoticeText"="") > C:\\spin\\LegalNoticeText.reg
_EOT1_
               chmod 755  $spinDirCygwin /LegalNoticeText.*
               cd $spinDirCygwin 
               cmd /c LegalNoticeText.bat
               chmod 755 LegalNoticeText.reg
               regedit.exe /s LegalNoticeText.reg

               tee  $spinDirCygwin/LegalNoticeText2.bat<< _EOT1_     
(echo Windows Registry Editor Version 5.00 && echo
 [HKEY_LOCAL_MACHINE\\Software\Microsoft\Windows\CurrentVersion\policies\system]
 && echo "legalnoticecaption"="" && echo "legalnoticetext"="")
 > C:\\spin\\LegalNoticeText2.reg
_EOT1_
               chmod 755  $spinDirCygwin /LegalNoticeText2.*
               cd $spinDirCygwin 
               cmd /c LegalNoticeText2.bat
               chmod 755 LegalNoticeText2.reg
               regedit.exe /s LegalNoticeText2.reg
           EOS

After successful updates to the registry, install IIS V6. Instead of using Cygwin (usually from a Tivoli Provisioning Manager work flow scriptlet) to install IIS V6, schedule a task. A task can invoke a batch file containing the commands to install IIS V6 successfully. That way, you can run the task immediately after scheduling it. See Listing 3.

Listing 3. Installing IISv6
var noZipName = Jython(SoftwareInstallableFileName[0:-4])
 var schCreateCmd = "schtasks /create /tn \"IISInstallSch\" /tr \"C:\\spin\\" + noZipName
 + "\\spinPackage\\sce-iis-v6-install.bat\"" + "  /sc daily /ru Administrator /rp "
 + decryptedPassword
 var path =  "C://spin//" + noZipName + "//spinPackage//"
 try 
  Device.ExecuteCommand(DeviceID, schCreateCmd,path,"default", "6000", "ignore",
 <null>, <null>, <null>)
 catchall e
  log warning "IIS schtasks creation failed: " + e
  # enable rsa ssh sap
  Cloud_Set_RSA_Credentials(DeviceID, "Administrator")
  rethrow
 endtry

 var schRunCmd = "schtasks /run /tn \"IISInstallSch\""
 path =  "C://"
 try 
  Device.ExecuteCommand(DeviceID, schRunCmd,path,"default", "6000", "ignore",
 <null>, <null>, <null>)
 catchall e
  log warning "IIS schtasks run failed: " + e
  # enable rsa ssh sap
  Cloud_Set_RSA_Credentials(DeviceID, "Administrator")
  rethrow
 endtry

You can monitor the installation log and then exit the installation procedure when done.

The following commands schedule a cron job, run immediately, and then delete the job when finished:

  • To schedule a job to run daily at the current time:
    schtasks /create /tn "Test Cron Jobquot; /tr quot;C:\test.batquot; /sc daily /ru 
    administrator /rp passwd
  • To run the job immediately:
    schtasks /run /tn quot;Test Cron Jobquot;
  • To delete the job:
    schtasks /delete /tn quot;Test Cron Jobquot; /f
  • To read the last result field (a "0" means install is a success):
    schtasks /query /fo LIST /v

Conclusion

This method of invoking the installation can be performed for any software installation that demonstrates any of these potential issues while trying to get software installed using an SSH connection through Cygwin software.

Technologies in this article

The free and open source Cygwin is a UNIX®-like environment and command line interface for Windows that provides native integration of Windows-based applications, data, and other system resources with applications, software tools, and data of the UNIX-like environment. You can do things like launch Windows applications from the Cygwin environment and use Cygwin tools and applications within the Windows operating context.

Cygwin consists of:

  • A dynamic-link library (DLL) as an API compatibility layer that provides a substantial part of POSIX API functionality.
  • Software tools and applications that provide a UNIX-like look and feel.

IBM's Rapid Deployment Services is an integrated set of services designed to aid in complex, multiproduct deployments. RDS uses an automated, pattern-driven approach and comprehensive testing and validation to help reduce deployment time, error rates, and the need for specialized skills.

Resources

Learn

Get products and technologies

Discuss

  • Get involved in the developerWorks community. Connect with other developerWorks users while exploring the developer-driven blogs, forums, groups, and wikis.

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into Cloud computing on developerWorks


  • Bluemix Developers Community

    Get samples, articles, product docs, and community resources to help build, deploy, and manage your cloud apps.

  • developerWorks Labs

    Experiment with new directions in software development.

  • DevOps Services

    Software development in the cloud. Register today to create a project.

  • Try SoftLayer Cloud

    Deploy public cloud instances in as few as 5 minutes. Try the SoftLayer public cloud instance for one month.

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Cloud computing, Tivoli
ArticleID=856086
ArticleTitle=SmartCloud+ tip: Install IIS on Windows with TSAM and Cygwin
publish-date=01242013