Author Posts

August 28, 2014 at 1:37 pm

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
               .

August 29, 2014 at 5:31 am

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.

August 29, 2014 at 8:42 am

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

August 29, 2014 at 9:02 am

Most likely the problem and the solution is this:

http://blog.coretech.dk/kaj/why-i-cant-convert-my-windows-server-2012-r2-core-to-gui/

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.

August 29, 2014 at 10:19 am

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 ?

August 29, 2014 at 10:24 am

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.

August 29, 2014 at 10:28 am

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.

August 29, 2014 at 10:44 am

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.

August 29, 2014 at 6:57 pm

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

August 31, 2014 at 12:17 pm

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!

September 2, 2014 at 5:12 am

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.

September 2, 2014 at 5:22 am

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!

September 2, 2014 at 12:57 pm

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.