Using PowerShell 5.0
I have a current configuration that configures my server. I would like to modify this configuration so that the last step removes the mof file from the system (c:\windows\system32\configuration).
How can I use the following cmdlet in my configuration?`
This was an awesome experiment. Summary:
Removing the configuration is really an orchestration level event that should/must take place outside of DSC.
What happens if you try to run Remove-DSCConfigurationDocument from inside a DSC configuration?
The configuration will fail with the following error.
Cannot invoke the Remove-DscConfigurationDocument cmdlet. The Start-DscConfiguration cmdlet is in progress and must return before Remove-DscConfigurationDocument can be invoked.
What happens if you use the File resource to remove all versions of the MOF from a configuration?
The Previous.MOF file was cleanly deleted. The Current.MOF file was not found because it didn't exist yet, and was present on the system after the configuration completed. The Pending.MOF file was deleted but that caused the configuration to fail when it attempted to copy Pending to Current.