2 versions of xPSDesiredStateConfiguration


I am using PS 5.1 on Win 10 Enterprise. I am currently going through the DSC Training on MVA.
I am at the HTTP Pull Server Script section.

I have installed the xPSDesiredStateConfiguration Module using OneGet.
In the script i get a red line under:

Import-DSCResource -ModuleName xPSDesiredStateConfiguration

The error: Multiple versions of the module ‘xPSDesiredStateConfiguration’ were found. You can run Get-Module -ListAvailable -FullyQualifiedName xPSDesiredStateConfiguration to see available versions on the system, and then use the fully qualified name ‘@{ModuleName=“xPSDesiredStateConfiguration”;RequiredVersion=“Version”}’

When i run:

PS C:\Windows\system32> Get-Module -ListAvailable -FullyQualifiedName xPSDesiredStateConfiguration

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands                                                                    
---------- -------    ----                                ----------------                                                                    
Script    xPSDesiredStateConfiguration        {Publish-MOFToPullServer, Publish-DSCModuleAndMof, Publish-ModuleToPullServer}      
Manifest    xPSDesiredStateConfiguration                                                                                            

I am also getting a red line under xDSCWebService
Undefined DSC resource ‘xDscWebService’. Use Import-DSC-Resource to import the resource.

When i run:

Import-DSCResource -ModuleName xPSDesiredStateConfiguration

I get error: The term ‘Import-DSCResource’ is not recognised as the name of a cmdlet, function, script file or operable program.

I am confused here.

  1. Why is there v3 and v7 of xPSDesiredStateConfiguration. Is v3 built into the system how can i remove it?
  2. Do I still need to OneGet this xPSDesiredStateConfiguration Module or is this now built into Win10/PS5.1?
  3. On PowerShell Gallery there is a module PSDscResources, do I need this and how does it differ to xPSDesiredStateConfiguration.
  4. How can I check what functions and cmdlets are in these new modules is there a cmdlet in PS I can run to view them all or get help on them to show examples?

Your help is appreciated.

Import-DscResource is only valid in a configuration script. You can’t run it elsewhere. And, since you have multiple versions installed, you just need to indicate which version you want to import, when running Import-DscResource. That’s what the first error is getting at.