Package Resource: Absent Error 1605

I am using a package resource with ensure=absent to make sure MVC isn’t installed on my web servers. If MVC isn’t installed the configuration runs without error. In testing my configuration I installed MVC 4 manually and then reran my configuration. It attempts to uninstall MVC but results in the following error:

PS C:\Windows\system32> invoke-dscResource -Name package -method set -property @{ name=“MVC4”;ensure=“absent”; path=“C:
program files\microsoft\web platform installer\webpicmd-x64.exe”; productId=“037a3c70-cc6a-4ae2-aa0e-70eb68ea81d5” }

invoke-dscResource : PowerShell DSC resource MSFT_PackageResource failed to execute Set-TargetResource functionality
with error message: The return code 1605 was not expected. Configuration is likely not correct
At line:1 char:1

  • invoke-dscResource -Name package -method set -property @{ name=“MVC4” …
  •   + CategoryInfo          : InvalidOperation: (root/Microsoft/...gurationManager:String) [Invoke-DscResource], CimEx
      + FullyQualifiedErrorId : ProviderOperationExecutionFailure,Microsoft.PowerShell.DesiredStateConfiguration.Command

It’s extremely likely that the Windows Installer package is what’s failing, and DSC is just reporting what it got from that. Have you tried running the uninstaller manually, to see what it does?

Uninstall via Programs and Features works as expected.

Sure… but that isn’t what DSC is doing, right? If we’re going to troubleshoot this, it’s got to be apples-to-apples. Can you manually uninstall it by running the command-line, which is what DSC would do?

And the next test is to write a short batch file which does so, and have Task Scheduler run it as System - since that’s the context DSC uses. See if the difference has anything to do with your login having different permissions or a user context, vs System.

THanks, I’ll try that.

Forgive me if I didn’t test this correctly but I ran the following command from the command line:

“C:\ProgramData\Package Cache{037a3c70-cc6a-4ae2-aa0e-70eb68ea81d5}\AspNetMVC4Setup.exe” /uninstall /quiet

And then also via a scheduled task as the System account.

In both cases the uninstall completed successfully although the command doesn’t provide any output/result. I also checked the Application Event Log and didn’t find any occurrences of the 1605 code.


Patience, Padawan. We had DSC camp running this weekend so I wasn’t focused on your plight with my usual laser like intensity. No need to get bumpy.

That being the case, I’ve truly no idea what the problem could be. Frankly, given that this is working as you’ve indicated, I’d probably just whip up a custom resource to run that exact command to handle the problem. The Package resource has always been a little magical and black-box-isn for me, and rather than banging my head against its brick wall, I’d just do what I know works.

Thank you very much for your help on this. I looked around but couldn’t find the package resource on GitHub. Is it open?

I wouldn’t mind digging around to see if I can find the issue.

No, Package is one of the ones that originally shipped with the OS and they’ve not open-sourced it to my knowledge.

Where I can report this bug to the PS team? The connect site appears to be down: