Where does Powershell DSC find module code?

I found an error in the Archive DSC module (MSFT_ArchiveResource.psm1). After copying the code, debugging it in ISE and finding out two lines that need to be fixed, I want to make changes to the real file and test it using Puppet and the msutter / dsc module, which uses the archive resource.

I found where, as I thought, there was a file location 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 modified code is not executing. (If I set $ Debug = $ true at the top of the file, I don’t see any additional output.) Is there some kind of cache on Windows that contains this file that I have to clear? Is it downloaded from ZIP or another archive?

I doubt Puppet refers to the problem, but mention it if he calls. (I just made a code change in the Agent.)

UPDATE:

When I run the following line in Powershell, I do not see 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 
+5
source share
2 answers

DSC Troubleshooting

My resources will not be updated: reset cache

The DSC engine caches resources implemented as a PowerShell module to enhance the effectiveness of the target. However, this can cause problems when creating the resource and testing it at the same time, since the DSC loads the cached version until the process is restarted. The only way to make DSC download the new version is to explicitly kill the hosting of DSC processes.

To determine which process the DSC mechanism is in, and stop it on the basis of each instance, you can specify the process identifier WmiPrvSE, which hosts the DSC mechanism. Then, to update the provider, stop WmiPrvSE using the commands below, and then run the 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 
+5
source

WMF 5.0 DSC adds the ability to force import of modules without killing the process. This is described on MSDN here .

Here is an example of how to enable it:

 configuration settings { LocalConfigurationManager { DebugMode = 'ForceModuleImport' } } $outputPath = "$env:temp\lcmSettings" settings -outputPath $outputPath Set-DscLocalConfigurationManager -Path $outputPath -Force -Verbose 
0
source

All Articles