PowerShell / PackageManagementProviderResource

Modules with DSC resources for the PackageManagement(aka OneGet) providers.
MIT License
37 stars 24 forks source link

The term 'PSModule' is not recognized as the name of a cmdlet #42

Open VerdonTrigance opened 4 years ago

VerdonTrigance commented 4 years ago
PS C:\Windows\system32> Get-InstalledModule PackageManagement

Version              Name                                Repository           Description                                                                                                                                                                    
-------              ----                                ----------           -----------                                                                                                                                                                    
1.4.7                PackageManagement                   PSGallery            PackageManagement (a.k.a. OneGet) is a new way to discover and install software packages from around the web....                                                               
Configuration PSModulesConfig
{
    Import-DscResource -ModuleName 'PSDesiredStateConfiguration'    
    Import-DscResource -ModuleName @{ModuleName="PackageManagement"; RequiredVersion="1.4.7"}

    Node $AllNodes.NodeName {
        foreach ($moduleName in $Node.Modules) {        
            PSModule $moduleName {              
                Name = $moduleName
                Ensure = "Present"
                InstallationPolicy = "Trusted"
            }
        }
    }
}
PSModulesConfig -OutputPath $OutputPath -ConfigurationData "$PSScriptRoot\ConfigurationData.psd1"

Resulting to:

PSDesiredStateConfiguration\Node : The term 'PSModule' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that 
the path is correct and try again.