I found an error in the Archive DSC module (MSFT_ArchiveResource.psm1). After copying the code, debugging it in the ISE and figuring out the two lines that needed to be fixed, I want to make the change to the real file and test using Puppet and the msutter/dsc module, which makes use of the Archive Resource.
I found where I thought was the location of the file on my machine:
C:\Windows\System32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\DSCResources\MSFT_ArchiveResource\MSFT_ArchiveResource.psm1
However, when I run Puppet, it is clear that my changed code is not being exercised. (If I set $Debug = $true at the top of the file, I do not see the extra output.) Is there some Windows cache that holds this file that I must clear? Is it being loaded from a ZIP or other archive?
I doubt that Puppet is related to the issue, but mention it in case it rings a bell. (I only made the code change on the Agent.)
UPDATE:
When I run the following line in Powershell, I do not find any process with the expected name containing "dsccore":
Get-WmiObject msft_providers | select -ExpandProperty provider
Results:
RegistryEventProvider
PolicyAgentInstanceProvider
CIMWin32
Msft_ProviderSubSystem
SCM Event Provider
Win32_WIN32_TERMINALSERVICE_Prov
WmiPerfClass
WmiPerfClass
WmiPerfInst
WmiPerfInst
My resources won’t update: How to reset the cache
The DSC engine caches resources implemented as a PowerShell module for efficiency purposes. However, this can cause problems when you are authoring a resource and testing it simultaneously because DSC will load the cached version until the process is restarted. The only way to make DSC load the newer version is to explicitly kill the process hosting the DSC engine.
To identify which process is hosting the DSC engine and stop it on a per instance basis, you can list the process ID of the WmiPrvSE which is hosting the DSC engine. Then, to update the provider, stop the WmiPrvSE process using the commands below, and then run Start-DscConfiguration again.
###
### find the process that is hosting the DSC engine
###
$dscProcessID = Get-WmiObject msft_providers |
Where-Object {$_.provider -like 'dsccore'} |
Select-Object -ExpandProperty HostProcessIdentifier
###
### Stop the process
###
Get-Process -Id $dscProcessID | Stop-Process
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With