DSC Resources not recognizing by LCM on New server

We are facing a weird issue using DSC at the time of deployment.

Error Details:
We are in the process of deploying the DSC PowerShell scripts in DEV environment for the first time. The DSC modules are copied to the Staging server to PSModulePath(C:\Program Files\WindowsPowershell\Modules), but at the time of deployment the modules are not getting recognized. This happens only when we are trying DSC deployments on the server for the first time. Rebooting the server solves the issue and DSC modules are loaded correctly. We are using WMF 4.0 .

Reboot somehow allows us to use DSC deployments, but moving forward onto PROD environment, we cannot restart all the servers that we try deployment on. Can someone help us understand what needs to be done in order to get the DSC modules\Resources recognized by LCM without a server restart.

Appreciate some quick help. Thanks in advance.

I don’t think I’m following what the problem is, and I’m not sure what you mean by “DSC deployments.”

So, you have a Staging server, and you’re storing modules in the Program Files path. Good. Those modules would be usable by the LCM on that Staging server. Generally speaking, the LCM should be able to locate modules that are in the PSModulePath, which is what I think you’re saying.

I guess I don’t understand what you mean by “at the time of deployment.” What exactly are you doing? Are you copying new modules to the Staging server and finding that its LCM isn’t recognizing them? How can you tell?

This can happen on WMF 4.0 when PSModulePath of the process and that of the system are different. This issue is fixed in WMF 5.0. One workaround that may work is to update the PSModulePath of the process to explicitly include Program Files module path, you may have to apply the configuration up to three times for the configuration to succeed. That is the only way I can think of to avoid reboot.