这样写出配置文件并运行该命令后就可以弹出一个WINDOWS组件安装的界面并自动安装我们指定的组件了,可是还有一个问题就是,这样安装的话中间会不停地弹出让用户选择路径,这样就不是真正的无人值守安装了。MDSN上的解释是: Note Windows always looks for the media that the server was originally installed from. If the server was installed from a CD, the unattended installation prompts you for the Windows CD. If you want to run the unattended installation and use media that is stored on a network share, you must change the value for the SourcePath subkey and the ServicePackSourcePath subkey in the following registry subkey: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup Change the values for the SourcePath subkey and the ServicePackSourcePath subkey to the appropriate network shares. The path must contain the i386 folder. 如果我们想将组件的安装位置指定于光盘以外的其它驱动/文件夹的话,必须更改那两项注册表值,并且该文件夹符合包含I386子文件夹的特征。这样将该两项值改为我们提供的IIS组件安装包,并把文件放至I386文件夹下,那么我们的IIS6无人值守功能就实现了,测试后成功安装IIS6组件,并且安装完毕后自动重启系统,加上/r属性,正常安装不重启,于是sysocmgr /i:sysoc.inf /r /u:x:\myConfig.txt
下面是一个在InstallShield中实现IIS组件是否安装与未安装时自动安装IIS: prototype NUMBER CheckIIS(); prototype InstallIIS();
////////////////////////////////////////////////////////////////////////////// // FUNCTION: CheckIIS // 示例:检查系统是否安装IIS ////////////////////////////////////////////////////////////////////////////// function NUMBER CheckIIS() NUMBER nvType, nvSize; STRING svvalue; begin RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE ); if (RegDBKeyExist ("System\\CurrentControlSet\\Services\\IISADMIN" ) = 1)then return (1); else return (0); endif; end;
安装处理脚本时: Dlg_IISCheck: //显示即将进行安装条件检查 listTopics = ListCreate (STRINGLIST); listDescriptions = ListCreate (STRINGLIST); if (listTopics = LIST_NULL) || (listDescriptions = LIST_NULL) then MessageBox("Unable to create lists.", INFORMATION); abort; endif; ListAddString (listTopics, "Internet 信息服务(IIS):", AFTER); ListAddString (listDescriptions, "Mircosoft Internet信息服务(IIS)提供基于网络的WWW服务", AFTER); // Display the topics and descriptions. nResult=SdDisplayTopics ( "程序运行软件环境", "请确认下列软件环境配置已完毕",listTopics,listDescriptions, 0); // Remove the lists from memory. ListDestroy (listTopics); ListDestroy (listDescriptions); if (nResult = BACK) then goto Dlg_SdLincese; else //基础条件安装检查 if (CheckIIS()!=1) then SdShowMsg ( "检测到系统尚未安装IIS组件,下面将自动安装IIS组件" , TRUE ); InstallIIS(); SdShowMsg ( "" , FALSE ); Delay( 1 ); endif; endif;
MSDN上对于配置IIS文件格式及内容的说明,本例只用于XP安装,下面的配置设置好也可用于SERVER2003的IIS安装。 Table B.1 lists the unattended installation parameters for IIS that you include in the [Components] section of the answer file. The default setting for all of the following parameters is off unless a component is required by some other component that you are installing. For example, if you are installing the World Wide Web Publishing Service (WWW service), then Common Files, IIS Manager, and network COM+ access are turned on by default. Table B.1 IIS Unattended Installation Parameters Parameter Description aspnet= on/off Enable ASP.NET . complusnetwork = on/off Enable network COM+ access. dtcnetwork = on/off Enable network Distributed Transaction Coordinator (DTC) network access. bitsserverextensionsisapi = on/off Enable the BITS Server Extensions ISAPI. bitsserverextensionsmanager = on/off Enable the BITS Server Extensions snap-in. iis_common = on/off Enable Common Files. iis_ftp = on/off Enable the File Transfer Protocol (FTP) service. fp_extensions = on/off Enable FrontPage? 2002 Server Extensions from Microsoft. iis_inetmer = on/off Enable IIS Manager. iis_nntp = on/off Enable the Network News Transfer Protocol (NNTP) service. iis_smtp = on/off Enable the Simple Mail Transfer Protocol (SMTP) service. iis_asp = on/off Enable Active Server Pages (ASP). iis_internetdataconnector = on/off Enable Internet Data Connector (IDC). sakit_web = on/off Enable Remote Administration (HTML). You cannot perform an unattended installation of this feature simultaneously with performing an unattended installation of the operating system. You can perform an unattended installation of this feature if you install IIS after you have installed the operating system by using the Sysocmgr.exe command-line utility. This feature is not available on Itanium-based computers running Windows XP 64-Bit Edition; the 64-bit version of Windows Server 2003, Enterprise Edition; or the 64-bit version of Windows Server 2003, Datacenter Edition. tswebclient = on/off Enable remote desktop Web connection. iis_serversideincludes = on/off Enable server-side includes (SSI). iis_webdav = on/off Enable WebDAV publishing. iis_www = on/off Enable the WWW service. appsrv_console = on/off Enable Application Server Console. This feature is not available on Itanium-based computers running Windows XP 64-Bit Edition. inetprint = on/off Enable Internet printing.
Table B.2 lists the optional IIS unattended installation parameters. You include these parameters in the [InternetServer] section. Table B.2 Optional IIS Unattended Installation Parameters Parameter Description SvcManualStart = www and/or ftp If WWW or FTP is present, those services will be set to manual start. If you specify both www and ftp, separate them with a comma (,). When installed, the default service state is to automatically start. PathFTPRoot = path to FTProot Alternate path to which the FTP service is installed. The default is systemroot\Inetpub\Ftproot. PathWWWRoot = path to WWWroot Alternate path to which the WWW service is installed. The default is systemroot\Inetpub\Wwwroot. ApplicationDependency = ApplicationName, GroupID, GroupID Adds application and dependencies. For example: ApplicationDependency = CommerceServer, ASP, IndexingService ApplicationDependency = ExchangeServer, ASP60 ApplicationDependency = MyApp, ASP.NET v1.1.4322 This example makes Commerce Server dependent on ASP and the Indexing Service, Exchange Server dependent on ASP, and MyApp dependent on ASP.NET v1.1.4322. ExtensionFile = <Enabled Flag>,<File Path>[ ,<UI Deletable Flag> [ ,<Group ID> [ ,<Description> ] ] ] Specifies an extension file. The UI Deletable Flag, Group ID, and Description settings are all optional. However, if you specify any of the optional settings, you must include all of the previous settings. The parameters represent the following: Enabled Flag is set to 0 (zero) for disabled and 1 for enabled. File Pathis the path to the file, and it can contain environment variables. UI Deletable Flag specifies whether the item can be deleted using IIS Manager. Set to 0 for not deletable and 1 for deletable. Group ID allows you to group different dynamic-link libraries (DLLs) and Common Gateway Interfaces (CGIs) and have dependencies for the applications. Description is the description of the extension file. For example: ExtensionFile = 1, windir\MyISAPIS\Myisapi.dll, 1, MyGroup, My Custom ISAPI –Or– ExtensionFile = 1, windir\MyCGIs\Mycgi.cgi, 1, MyGroup, My Custom CGI DisableWebServiceOnUpgrade = True/False The default for this parameter is True for upgrades from the Microsoft? Windows? 2000 Server operating system, unless you have run the IIS Lockdown Tool or added the registry entry RetainW3SVCStatus to the registry. Please see Caution below. For more information about when the WWW service is disabled after an upgrade has been performed, see Upgrading an IIS Server to IIS 6.0.