New Version of Custom Resource issue

From what I understand, in order to update a custom DSC resource automatically from a pull server, you need to update the resources data file (.psd1) with the updated version number, then regenerate any MOF that consumes the resource in order to have the resources version updated in MOF.

I am having an issue publishing a new version of a resource, call it CustomResourceA. When the resource was first published, I created zip and checksum files, CustomResourceA_1.0.zip and CustomResourceA_1.0.zip.checksum. I then updated the resource, updated the version to version 1.1 in the psd1 file and created new zip and checksum files, CustomResourceA_1.1.zip and CustomResourceA_1.1.zip.checksum. Then I recreated the MOF that references the resource and checked it to ensure the MOF references the updated version of the resource. After publishing these to my pull server, I forced an evaluation on the target machine. I get the following error:

Invoke-CimMethod : A generic exception occurred during the processing of zip files downloaded by Download Manager WebDownloadManager.

I see a new version of the resource in c:\program files\windowspowershell\modules along with a backup directory called CustomResourceA_tmp.

If I force another evaluation everything runs fine. However, if I update the resource again and follow all the same steps as above, I get another error (same as above). Once I delete the CustomResourceA_tmp, everything runs fine.

Has anyone seen this before? Or is there something I’m doing wrong?

That’s a bug in WMF 4.0; it’s not cleaning up those _tmp folders after itself, and for the time being, we need to do that ourselves (perhaps with a scheduled task.) This is fixed in the WMF 5.0 preview, and hopefully there will be a patch to fix this in 4.0 as well.