Cached Resource

This topic contains 0 replies, has 1 voice, and was last updated by  RussellR 7 months ago.

  • Author
  • #144054

    Topics: 3
    Replies: 7
    Points: 65
    Rank: Member

    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?

    I'm running an on-premise DSC https pull server with very few clients so far.  All servers run on Windows Server 2016 with PowerShell 5.1.

    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\\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:

    [string[]] $heroes = "The Incredible Hulk",'Black Widow','Thor','Professor Hulk','Captain Marvel','My Wife'
    $superhero = $this.heroes | Get-Random

    If needed, I can post all of the code in the TestMod.


    Thanks in advance,


The topic ‘Cached Resource’ is closed to new replies.