dsccommunity / ComputerManagementDsc

DSC resources for for configuration of a Windows computer. These DSC resources allow you to perform computer management tasks, such as renaming the computer, joining a domain and scheduling tasks as well as configuring items such as virtual memory, event logs, time zones and power settings.
https://dsccommunity.org
MIT License
300 stars 83 forks source link

Missing DscResource.Common file #358

Closed ghost closed 3 years ago

ghost commented 3 years ago

Hello,

I recently downloaded ComputerManagementDsc to utilize PendingReboot resource but I am getting the following error message when I try to import-dscresource

'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ComputerManagementDsc\Modules\DscResource.Common' was not loaded because no valid module file was found in any module directory. LCM failed to start desired state configuration manually.

I don't see the DscResource.Common file in the package I downloaded, is this a file I need to download separately?

ComputerManagementDsc.Common.psm1 file: $modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'DscResource.Common')

I see the two lines above in the ComputerManagementDsc.Common.psm1 file, when we import-module shouldn't we put .psm1? like below? Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'DscResource.Common')

gaelcolas commented 3 years ago

Thanks for spotting this. No this is a.mistake as it should be included already. Can you please confirm which version you installed!

ghost commented 3 years ago

Hello, I downloaded the most recent version

ghost commented 3 years ago

the latest :)

gaelcolas commented 3 years ago

Had a quick look and it seems to be there: image

Can you try importing in your PowerShell, maybe re-download or re-install (-Force).

PlagueHO commented 3 years ago

That is really strange. It does look like the DSCResource.Common files are included in the package for v8.4.0 (latest release) and v8.4.1-preview0002 (latest preview release).

ghost commented 3 years ago

I'm sorry, i downloaded again but I don't see the version folder (8.4.0)

image

ghost commented 3 years ago

I was able to download the 8.4 version from PowerShell gallery! :)

gaelcolas commented 3 years ago

So if you do a git clone it won't be there as those are the source file (in your screenshot above).

Indeed, to use the module you ought to get it from the PowerShellGallery, either via the Web or using Install-Module ComputerManagementDsc.