How do I use DSC to enable psremoting?

I cannot use DSC to enable-psremoting because I do not know which registry entries need to be changed.

This link

has two registry keys. One I couldn’t find. The other didn’t change when I enabled and disabled psremoting. I therefore could not use the link to do what I need to do. How do I use DSC to enable psremoting? Or is there no declarative way?

Remoting involves a bit more than just the registry. There’s also a Wsman configuration, potentially firewall exceptions, and a good bit more. Keep in mind that DSC is primarily focused at server workloads right now, and Win2012+ have Remoting enabled by default. So Microsoft just hasn’t focused on making Remoting a declarative thing. I mean, obviously, you could check to see if the local Wsman: drive exists (meaning Remoting was at least set up), and run Enable-PSRemoting if not, but that’s going to get a little hacky.

The test whether powershell remoting is enabled or not can be done using:

  1. Check if winrm service is running: Get-Service winrm.
  2. Check if endpoint is setup: Invoke-WsManAction -Action analyze -ResourceURI winrm/config/service
  3. Check if PS Plugin is registered: dir WSMan:\localhost\Plugin\microsoft.powershell
    If any of the test fails, you need to run Enable-PSRemoting to enable remoting.