分享

How to install IIS Management tools with DISM on Windows 7

 icecity1306 2014-09-12

I'm trying to install the IIS management tools using the command line on Windows 7 SP1 x64.

I executed the following command line:

dism /online /enable-feature /featurename:IIS-WebServerManagementTools /featurename:IIS-ManagementConsole

But, I get an error that the "IIS-WebServerRole" feature needs to be enabled.

So, I execute this command:

dism /online /enable-feature /featurename:IIS-WebServerRole /featurename:IIS-WebServerManagementTools /featurename:IIS-ManagementConsole

This works, but also installs the IIS Webserver!  Including the WWW publishing service and inetpub folder.

How do I install the IIS management tools [unattended] without installing the entire IIS server?

 

The problem is:  If you enable the IIS-WebServerRole feature using dism, it automatically enables the IIS-WebServer feature.


-Tony


答案

  • I finally created a useable workaround.

    Create a text file called, say, unattend.xml and place this contents in it:

    <?xml version="1.0" encoding="utf-8"?>
    <unattend xmlns="urn:schemas-microsoft-com:unattend">
        <servicing>
            <package action="configure">
                <assemblyIdentity name="Microsoft-Windows-Foundation-Package" version="6.1.7601.17514" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="" />
                <selection name="IIS-ManagementConsole" state="true" />
                <selection name="IIS-WebServerRole" state="true" />
                <selection name="IIS-LegacySnapIn" state="true" />
                <selection name="IIS-IIS6ManagementCompatibility" state="true" />
                <selection name="IIS-WebServerManagementTools" state="true" />
                <selection name="IIS-Metabase" state="true" />
                <selection name="IIS-WebServer" state="false" />
            </package>
        </servicing>
    </unattend>

    Run this command to install the components:

    dism /online /Apply-Unattend:unatend.xml /norestart

    This will install the IIS management tools without installing the IIS Web Server.  In fact, it will uninstall the IIS Web server if installed.

    So, I use this code to prevent that:

    var UFILE = "unattend.xml";
    
    // Check to see if IIS Web Server is installed
    var iis_installed = (objShell.Run("cmd.exe /c dism /online /get-featureinfo /featurename:IIS-WebServer | find /i \"state : enabled\"", 0, true)==0);
    
    // If IIS Web Server was already installed, remove line that uninstalls it
    if (iis_installed) replace_text_in_file(UFILE,"<selection name=\"IIS-WebServer\" state=\"false\" />", "");
    
    // enable features
    objShell.Run("dism /online \"/Apply-Unattend:" + UFILE + "\" /norestart", 1, true);

    The call to replace_text_in_file replaces the line that disables the Web Serve with a blank line.

    I do this, and a similar check for the Hyper-V management tool for Windows 8.


    -Tony


    • 已编辑 Tony MCP 2013年8月19日 21:56
    • 已标记为答案 Tony MCP 2013年8月19日 21:56

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多