How to handle drift after manual changes and what is the pending.mof.tmp file in Powershell DSC?

155 Views Asked by At

I installed IIS using DSC a while back and since then changes have been made manually to the IIS configuration. Recently, someone ran Start-DSCConfiguration and it reported that IIS configuration had drifted and it will be corrected as per the original config defined in the DSC, but looks like this hasn't happened yet. My worry is it will after restarting the server/IIS.

We don't want the settings to be removed, so I ran Remove-DscConfigurationDocument. I can see pending.mof has been deleted but pending.mof.tmp resides in C:\Windows\System32\Configuration.

Does anyone know what is the pending.mof.tmp file? Also, if I restart my server, will it revert to original configuration, removing the manual changes?

1

There are 1 best solutions below

0
Confounder On

Thanks Bruce.

After running Remove-DscConfigurationDocument on the IIS server and restarting, the configuration did not change and the manual IIS settings remained in place, which is what we wanted.

If the LCM configuration mode is ApplyAndMonitor, then DSC applies any new configuration when Start-Dscconfiguration is executed against the server and only logs drift - it automatically does not apply to correct drift in this mode.

Also, running the following returns any configuration that's drifted

PS> $Status = Get-DscConfigurationStatus
PS> $Status.ResourcesNotInDesiredState

This will also highlight any errors if configuration is not correct and LCM shows Pending Configuration (pendingconfiguration).