Windows Feature with Source

This topic contains 12 replies, has 3 voices, and was last updated by Profile photo of David Jones David Jones 2 years, 3 months ago.

  • Author
    Posts
  • #18373
    Profile photo of David Jones
    David Jones
    Participant

    I'm trying to use DSC to switch from Core to GUI on 2012. I'm using the below in my composite config.

    Configuration GuiServer
    {
        param (
        )
        Import-DscResource -ModuleName PDSResorces
    
        WindowsFeature GuiManagementToosl
        {
            Ensure = 'Present'
            Name =  'Server-Gui-Mgmt-Infra'
            Source = 'wim:D:\sources\install.wim:2'
        }
        WindowsFeature GuiShell
        {
            Ensure = 'Present'
            Name =  'Server-Gui-Shell'
            Source = 'wim:D:\sources\install.wim:2'
        }
    
    }

    The CD is mounted as D: but I'm getting this error.

    EventType    : ERROR
    TimeCreated  : 8/28/2014 4:11:46 PM
    Message      : This event indicates that a non-terminating error was thrown when DSCEngine was executing
                   Set-TargetResource on MSFT_RoleResource provider. FullyQualifiedErrorId is DISMAPI_Error__Failed_To_Enab
                   le_Updates,Microsoft.Windows.ServerManager.Commands.AddWindowsFeatureCommand. ErrorMessage is The
                   request to add or remove features on the specified server failed.
                   Installation of one or more roles, role services, or features failed.
                   The source files could not be found.
                   Use the "Source" option to specify the location of the files that are required to restore the feature.
                   For more information on specifying a source location, see
                   http://go.microsoft.com/fwlink/?LinkId=243077. Error: 0x800f081f
                   .
  • #18376
    Profile photo of Istvan Szarka
    Istvan Szarka
    Participant

    Normally you can install features from the sources\sxs folder too. Just copy the folder into a file share and use it as the source, it might just work.

  • #18379
    Profile photo of David Jones
    David Jones
    Participant

    I tried placing Sorces\SXS on the network with a share that the machine account has access. that got the same error.

  • #18381
    Profile photo of Istvan Szarka
    Istvan Szarka
    Participant

    Most likely the problem and the solution is this:

    You just have to update the WIM image you want to use as the source. I've also ran into this problem before, when I wanted to install the GUI on a server core VM. It seems that if your source is "older" – i. e. it doesn't have the updates – than your target machine, the process breaks. I don't know why is that, but it can be very annoying.

  • #18382
    Profile photo of David Jones
    David Jones
    Participant

    That makes sense I installed two hotfixes required for DSC to work after I used that source to install.

    Do you know if there is issues if the source is has more patches then the VM ?

  • #18383
    Profile photo of Istvan Szarka
    Istvan Szarka
    Participant

    I don't know, but to be 100% sure, it'd be a good idea to apply the latest updates to both source and target.

  • #18385
    Profile photo of David Jones
    David Jones
    Participant

    You got a method to do that. your article did not reference where to get the patches. I have the ones I installed on this instance but I would need a pile of .msu files to get it current with windows update.

  • #18388
    Profile photo of Istvan Szarka
    Istvan Szarka
    Participant

    This is not my article, I just found it on Google. There are of course methods, I know of two that I think are easy to do:

    Check this out: http://windowsitpro.com/windows/add-updates-offline-vhd-or-wim-file
    John Savill wrote a script to apply a whole bunch of updates to offline WIM or VHD images.
    Everything is explained in his article and in his video here: https://www.youtube.com/watch?v=cOUlW2bJnK0&feature=youtu.be

    OR

    Fully update your target, which I guess is a Server Core 2012. Then, fully update a VM that is a Server 2012 with a GUI. Mount its VHD and use it as the source. I think it should then work.

  • #18400
    Profile photo of Paul D. Murphy
    Paul D. Murphy
    Participant

    You can use the dism powershell cmdlets to apply a hotfix to a wim. it's apply-something iirc.

  • #18405
    Profile photo of Istvan Szarka
    Istvan Szarka
    Participant

    I'm not familiar with Apply cmdlets. The PowerShell DISM module cmdlets are listed here: http://technet.microsoft.com/en-us/library/hh852126.aspx

    The problem with Add-WindowsPackage is, that it can only apply a single update file to an image, which isn't very useful in itself.

    I prefer this script because I just have to supply the path to the image and the path to the root folder where all the updates are, than it does all the work for me. It's so an extremely useful tool!

  • #18430
    Profile photo of David Jones
    David Jones
    Participant

    Add-WindowsPackage does every .msu or .cab in a folder. In fact just for fun I had a script supply it with ever sub-folder on the WSUS server's WsusContent folder. It ran for a few hours and complained a lot about patches that could not be applied but it did install a number of them. I have no idea if this is a viable solution yet to fully patch an image and have it work for what I'm trying to do. I will hopefully get a change to test that out today.

  • #18431
    Profile photo of Istvan Szarka
    Istvan Szarka
    Participant

    You're right, I was mistaken about Add-WindowsPackage. I never used it because I always use that script. I just looked at it's help file and must have missed the last example.
    Next time I'll have to test before I talk!

  • #18459
    Profile photo of David Jones
    David Jones
    Participant

    Pointing it at WSUS did the trick. I placed the WIM on a share and DSC did it's job.

    I made the following changes to the script mentioned by Istvan

    # Add the Updates to Windows Image
    $Updates = Get-ChildItem '\\wsusServer\e$\wsus\WsusContent'
    foreach($item in $Updates){
        Add-WindowsPackage  -Path "C:\WS2012R2" -PackagePath  $item.FullName -verbose
    }
    add-windowsPackage -Path "C:\WS2012R2" -PackagePath '\\Server\HotfixShare' -verbose

    The second add-windowsPackage is for any Hotfix that are not serviced by WSUS.

You must be logged in to reply to this topic.