PackageManagementProviderResource icon indicating copy to clipboard operation
PackageManagementProviderResource copied to clipboard

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

Open VerdonTrigance opened this issue 5 years ago • 0 comments

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.

VerdonTrigance avatar Jul 31 '20 13:07 VerdonTrigance