Installing web server with pkgmgr and powershellRSS

9 replies

Last post May 20, 2013 03:33 PM by jemMasters

  • Installing web server with pkgmgr and powershell

    Apr 16, 2008 01:53 PM|Kanien|LINK

    Hello,

     I have a 64bit wk8 server and I'm attempting to install the web server role and configure it through powershell as described in an article on iis.net.  My goal is to automate the configuration of my IIS7 web servers so that I do not have to configure them everytime I set a new one up.

     Here is my current problem:

     If I run get-process on the pkgmgr after attempting to make the call to pkgmgr it does not exist.  It is as if the pkgmgr is not starting.  Any suggestions?  I need to script it to install the web server role and features automatically.

    The PS code calls like this:

     #Get the path that this script is running in
    $scriptRoot = Split-Path (Resolve-Path $myInvocation.MyCommand.Path)

    #Call PKGMGR
    & $env:windir\system32\pkgmgr.exe ("/n:" + $scriptRoot + "\unattend.xml")

     The unattend.xml file looks like this:

     <?xml version="1.0" ?>
    <unattend xmlns="urn:schemas-microsoft-com:unattend"
        xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
    <servicing>
       <!-- Install a selectable update in a package that is in the Windows Foundation namespace -->
       <package action="configure">
          <assemblyIdentity
             name="Microsoft-Windows-Foundation-Package"
             version="6.0.5308.6"
             language="neutral"
             processorArchitecture="x86"
             publicKeyToken="31bf3856ad364e35"
             versionScope="nonSxS"
          />
        <selection name="IIS-WebServerRole" state="true"/>
        <selection name="IIS-WebServer" state="true"/>
        <selection name="IIS-CommonHttpFeatures" state="true"/>
        <selection name="IIS-StaticContent" state="true"/>
        <selection name="IIS-DefaultDocument" state="true"/>
        <selection name="IIS-DirectoryBrowsing" state="true"/>
        <selection name="IIS-HttpErrors" state="true"/>
        <selection name="IIS-HttpRedirect" state="true"/>
        <selection name="IIS-ApplicationDevelopment" state="true"/>
        <selection name="IIS-ASPNET" state="true"/>
        <selection name="IIS-NetFxExtensibility" state="true"/>
        <selection name="IIS-ASP" state="true"/>
        <selection name="IIS-CGI" state="true"/>
        <selection name="IIS-ISAPIExtensions" state="true"/>
        <selection name="IIS-ISAPIFilter" state="true"/>
        <selection name="IIS-ServerSideIncludes" state="true"/>
        <selection name="IIS-HealthAndDiagnostics" state="true"/>
        <selection name="IIS-HttpLogging" state="true"/>
        <selection name="IIS-LoggingLibraries" state="true"/>
        <selection name="IIS-RequestMonitor" state="true"/>
        <selection name="IIS-HttpTracing" state="true"/>
        <selection name="IIS-CustomLogging" state="true"/>
        <selection name="IIS-ODBCLogging" state="true"/>
        <selection name="IIS-Security" state="true"/>
        <selection name="IIS-BasicAuthentication" state="true"/>
        <selection name="IIS-WindowsAuthentication" state="true"/>
        <selection name="IIS-DigestAuthentication" state="true"/>
        <selection name="IIS-ClientCertificateMappingAuthentication" state="true"/>
        <selection name="IIS-IISCertificateMappingAuthentication" state="true"/>
        <selection name="IIS-URLAuthorization" state="true"/>
        <selection name="IIS-RequestFiltering" state="true"/>
        <selection name="IIS-IPSecurity" state="true"/>
        <selection name="IIS-Performance" state="true"/>
        <selection name="IIS-HttpCompressionStatic" state="true"/>
        <selection name="IIS-HttpCompressionDynamic" state="true"/>
        <selection name="IIS-WebServerManagementTools" state="true"/>
        <selection name="IIS-ManagementConsole" state="true"/>
        <selection name="IIS-ManagementScriptingTools" state="true"/>
        <selection name="IIS-ManagementService" state="true"/>
        <selection name="IIS-IIS6ManagementCompatibility" state="true"/>
        <selection name="IIS-Metabase" state="true"/>
        <selection name="IIS-WMICompatibility" state="true"/>
        <selection name="IIS-LegacyScripts" state="true"/>
        <selection name="IIS-LegacySnapIn" state="true"/>
        <selection name="IIS-FTPPublishingService" state="true"/>
        <selection name="IIS-FTPServer" state="true"/>
        <selection name="IIS-FTPManagement" state="true"/>
        <selection name="WAS-WindowsActivationService" state="true"/>
        <selection name="WAS-ProcessModel" state="true"/>
        <selection name="WAS-NetFxEnvironment" state="true"/>
        <selection name="WAS-ConfigurationAPI" state="true"/>
      </package>
    </servicing>
    </unattend>

  • JeongHwan JeongHwan

    50 Posts

    Microsoft

    Moderator

    Re: Installing web server with pkgmgr and powershell

    Apr 16, 2008 05:45 PM|JeongHwan|LINK

    I guess you have some version mismatch problem in the unattend.xml file. 
    Maybe the unattend.xml file was made for x86 previous Windows OS machine.

    Supposing your machine is AMD64 processor of Windows 2008 RTM, you will need to update the unattend.xml.

    If you still see the problem, please try to run these commands on DOS command prompt and let me know the error code.

    F:\test>start /w pkgmgr /n:f:\test\unattend.xml
    F:\test>echo %errorlevel%
    -2146498555

    BTW, if you see "-2146498555", it means there was still version mismatch problem in your unattend.xml file. Please try to set with correct major and minor version number with reading this registry key and try again.

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\BuildLabEx

    Jeong Hwan Kim
  • Re: Installing web server with pkgmgr and powershell

    Apr 16, 2008 05:50 PM|Kanien|LINK

    I pasted the default unattend.xml instead of my modified one.  The one below is the one I use.  When I attempted to run the pkgmgr from the start /w it gave me the error 9009. 

     

    <?xml version="1.0" ?>
    <unattend xmlns="urn:schemas-microsoft-com:unattend"
        xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
    <servicing>
       <!-- Install a selectable update in a package that is in the Windows Foundation namespace -->
       <package action="configure">
          <assemblyIdentity
             name="Microsoft-Windows-Foundation-Package"
             version="6.0.6000.16386"
             language="neutral"
             processorArchitecture="amd64"
             publicKeyToken="31bf3856ad364e35"
             versionScope="nonSxS"
          />

  • Re: Installing web server with pkgmgr and powershell

    Apr 16, 2008 05:56 PM|Kanien|LINK

    Actually,

     When I use start /w pkgmgr /n:f:unattend.xml it gives error 3, but if I don't use the /n:f: and instead use /n:unattend.xml it gives the -2146498555 error.

     I'll take a look at your link to see if it solves my issue.

  • Re: Installing web server with pkgmgr and powershell

    Apr 16, 2008 05:59 PM|Kanien|LINK

    Mine reads

     6001.18000.amd64fre.longhorn_rtm.080118-1840

    which is not what they told me to use.  I read in the article to go to c:\windows\regedit.exe > properties > details tab and grab the version# from there.

  • Re: Installing web server with pkgmgr and powershell

    Apr 16, 2008 06:10 PM|Kanien|LINK

    changing the version number fixed it.

  • JeongHwan JeongHwan

    50 Posts

    Microsoft

    Moderator

    Re: Installing web server with pkgmgr and powershell

    Apr 16, 2008 06:15 PM|JeongHwan|LINK

    Well, "f:" was not a part of option. It was drive name. My machine had F: drive. :-) 

    BTW, I think you should use this section instead. I confirmed this works in my Windows2008 RTM AMD64 machine.

    <package action="configure">

          <assemblyIdentity

             name="Microsoft-Windows-Foundation-Package"

             version="6.0.6001.18000"

             language="neutral"

             processorArchitecture="amd64"

             publicKeyToken="31bf3856ad364e35"

             versionScope="nonSxS"

          />

    Jeong Hwan Kim
  • JeongHwan JeongHwan

    50 Posts

    Microsoft

    Moderator

    Re: Installing web server with pkgmgr and powershell

    Apr 16, 2008 06:20 PM|JeongHwan|LINK

    Great to know that you have fixed the problem by yourself, Kanien!!!

    Jeong Hwan Kim
  • Re: Installing web server with pkgmgr and powershell

    Apr 16, 2008 06:26 PM|Kanien|LINK

    LOL, I didn't fix it myself. 

     Thanks for the help ;)

     btw..I looked to mark your post as an answer, but I don't have that option on this sub forum for some reason

  • Re: Installing web server with pkgmgr and powershell

    May 20, 2013 03:33 PM|jemMasters|LINK

    Hi!,

    I found this post when I was looking for an answer to fix your same problem. I'm getting the -2146498555 message, but I really don't know what to fix: 

    My code

    <assemblyIdentity
              name="Microsoft-Windows-Foundation-Package"
              version="6.2.9200.16384"
              language="neutral"
              processorArchitecture="x64"
              publicKeyToken="31bf3856ad364e35"
              versionScope="nonSxS"
    />

    Original Code:

    <assemblyIdentity
             name="Microsoft-Windows-Foundation-Package"
             
    version="6.0.5308.6"
             
    language="neutral"
             
    processorArchitecture="x86"
             
    publicKeyToken="31bf3856ad364e35"
             
    versionScope="nonSxS"
     
    />
     

    I wonder where did you get the correct information for your <assemblyIdentity/>  tag ?