0

On a system, a PowerShell DSC is applied, but I do not have the original script that was applied. How can I get a list of all operations that this configuration is supposed to do/ currently doing?

For example, if I have the original script, I can see what programs are being installed and what settings are being applied by the configuration, but how to do it without original script.

I want to uninstall a program being installed by DSC currently, but I am not able to update the DSC to allow removal of the program leaving other parts as is, so removing it seems to be the only option. Before removing it, I want to make sure that it does not do something else important. How can I do that?

Also, if I remove the current DSC, is previous or pending DSC applied?

  • `pending.mof` is a configuration that has been sent, but the LCM hasn't applied it yet. `current.mof` is the configuration in effect. `previous.mof` is the last successful configuration for rollbacks. If you remove the current DSC, `pending.mof` will be applied on the next LCM rotation, but `previous.mof` is never applied unless you rollback manually. – Maximilian Burszley Jan 11 '19 at 14:28

1 Answers1

2

You can use the Get-DscConfiguration cmdlet. You can also locate the .mof file used to configure DSC and examine that located at C:\Windows\System32\Configuration\

Maximilian Burszley
  • 18,243
  • 4
  • 34
  • 63
4c74356b41
  • 69,186
  • 6
  • 100
  • 141
  • Can you give me a little more idea on how to find the mof file and how to open it to get the details? –  Jan 05 '19 at 10:34
  • 1
    @psinaught I've updated his answer with some more detail. The `Current.mof` should be what you're looking for. You can view it with any text editor – Maximilian Burszley Jan 05 '19 at 17:29
  • @TheIncorrigible1 I cannot see Current.mof, only Pending. What does that mean? Also, I can only see binary data of Pending.mof using Get-content. Any idea what can I do? –  Jan 11 '19 at 14:00
  • @psinaught It means your configuration isn't applied. You should be able to use `Start-DscConfiguration`. I forgot that MSFT encrypts the mofs by default now. – Maximilian Burszley Jan 11 '19 at 14:21
  • @TheIncorrigible1 Is there a way to see what the configuration does before starting it? –  Jan 11 '19 at 16:04