Skip to content

Unable to load resources from module #196

@jeremyhagan

Description

@jeremyhagan

I have installed this module and the ComputerManagementDsc module on my development machine. Both are listed in the same directory.

    Directory: C:\Program Files\WindowsPowerShell\Modules


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        3/07/2024   4:49 PM                ComputerManagementDsc
d-----        9/01/2024   1:38 PM                Microsoft365DSC
d-----        9/01/2024   1:48 PM                ReverseDSC
d-----        4/07/2024   8:48 AM                SecurityPolicyDsc

However, when I run Get-DscResource, not resources from SecurityPolicyDsc are returned.

C:\Program Files\...\Modules> (Get-DscResource).ModuleName | select -Unique
ComputerManagementDsc
Microsoft365DSC
PackageManagement
PSDesiredStateConfiguration

Nor is the module listed when I run Get-Module:

C:\Program Files\...\Modules> get-module *dsc -ListAvailable


    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     9.1.0      ComputerManagementDsc
Manifest   1.24.103.1 Microsoft365DSC                     {Assert-M365DSCBlueprint, Compare-M365DSCConfigura...
Manifest   2.0.0.18   ReverseDSC                          {Get-DSCParamType, Get-DSCBlock, Get-DSCFakeParame...

And trying to import the module throws an error

C:\> import-module SecurityPolicyDsc
import-module : The specified module 'SecurityPolicyDsc' was not loaded because no valid module file was found in any module directory.

The only difference I can see between ComputerManagementDsc and SecurityPolicyDsc is that the former has a .psm1 and the latter doesn't. What do I need to do to get this module (and others like it) working?

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.17763.5458
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.5458
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions