DSC and installing Windows Features from CAB file

18 views
Skip to first unread message

Rob Sterenborg

unread,
Mar 22, 2022, 2:24:35 PMMar 22
to puppet...@googlegroups.com
Hi,

I'm in the process of migrating from old to new DSC modules, and I'm running into an issue when installing Windows Features.

I need feature "NET-Framework-Core" installed (so, .NET Framework 3.5). I'm installing this feature from a CAB file because this doesn't work from "Install-WindowsFeature", and I'm coming from "dsc_windowsoptionalfeature", which had a "source" parameter which "dsc_xwindowsoptionalfeature" doesn't have.

The Puppet code reads:

```
dsc_xwindowspackagecab {'NET-Framework-Core':
dsc_ensure => 'Present',
dsc_sourcepath => 'C:\Temp',
dsc_name => 'microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~amd64~~.cab',
dsc_logpath => 'C:\Temp\microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~amd64~~.log',
}
```

I keep getting:

```
Notice: /Stage[main]/Platform::Pre::Windows_features_role/Dsc_xwindowspackagecab[NET-Framework-Core]/dsc_logpath: dsc_logpath changed to 'C:\Temp\microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~amd64~~.log' (corrective)
Notice: /Stage[main]/Platform::Pre::Windows_features_role/Dsc_xwindowspackagecab[NET-Framework-Core]/dsc_ensure: dsc_ensure changed 'Absent' to 'Present' (corrective)
Notice: dsc_xwindowspackagecab[{:name=>"NET-Framework-Core", :dsc_name=>"microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~amd64~~.cab"}]: Creating: Finished in 8.88 seconds
```

Powershell shows the feature is installed, when it wasn't before:

```
PS C:\Windows\system32> (Get-WindowsFeature -Name NET-Framework-Core).InstallState
Installed
```

So I checked DSC as derived from the Puppet Agent debug trace output:

```
$InvokeParams = @{
Name = 'xWindowsPackageCab';
Method = 'get';
Property = @{
ensure = 'Present';
sourcepath = 'C:\Temp';
name = 'microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~amd64~~.cab'
};
ModuleName = @{
ModuleName = 'C:/ProgramData/PuppetLabs/puppet/cache/lib/puppet_x/xpsdesiredstateconfiguration/dsc_resources/xPSDesiredStateConfiguration/xPSDesiredStateConfiguration.psd1';
RequiredVersion = '9.1.0'
}
}

Invoke-DscResource @InvokeParams

ConfigurationName :
DependsOn :
ModuleName : C:/ProgramData/PuppetLabs/puppet/cache/lib/puppet_x/xpsdesiredstateconfiguration/dsc_resources/xPSDesiredStateConfiguration/xPSDesiredStateConfiguration.psd1
ModuleVersion : 9.1.0
PsDscRunAsCredential :
ResourceId :
SourceInfo :
Ensure : Absent
LogPath :
Name : microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~amd64~~.cab
SourcePath : C:\Temp
PSComputerName : localhost
```

DSC says that LogPath is empty, and that Ensure is Absent. Not what I expected.
The logfile as used in the code is written and contains lots of lines; lines are added with every Puppet Agent run.

I'm using Puppet Agent 6.26 with Puppet Server 6.17.1.

Can anyone hint me to what I'm missing?


Thanks,
Rob

Reply all
Reply to author
Forward
0 new messages