Cached Resource Not Updating
How do you force a DSC resource to update the cached version on a client? So far, deleting the cached resource seems best, but there’s probably a better way. Do I…
- keep deleting the cached resource folder?
- restart the DSC service?
- reboot the machine?
- do something else entirely?
When I realized my resources were not updating on the client servers, I decided to make a test resource. This test resource is class-based PowerShell and merely writes to a local text file. I can tell by the Verbose output from Test-DSCConfiguration that it hasn’t updated. I changed the Verbose output to give me a Superhero’s name each time. So far, no superheroes have shown up until I delete the cached resource form the client server.
I check the .psm1 cached file at C:\Program Files\WindowsPowerShell\Modules\TestMod\126.96.36.199\TestMod.psm1. The cached version stays the same until I manually remove it. I have read about restarting the service, rebooting the machine, etc. But I feel like all of these are a step beyond what an administrator should have to do whenever the resource is updated.
FYI, I have tried all of the options for LCM Debug mode: All, ForceModuleImport, None. These don’t appear to make any difference at all.
The verbose output comes from the following:
[DscProperty(NotConfigurable)][string] $heroes = "The Incredible Hulk",'Black Widow','Thor','Professor Hulk','Captain Marvel','My Wife'$superhero = $this.heroes | Get-RandomWrite-Verbose$superhero
Thanks in advance,