Get-DscResource

Gets the DSC resources present on the computer.
Get-DscResource [[-Name] [<String[]>]] [[-Module] [<Object>]] [-Syntax] [<CommonParameters>]

The Get-DscResource cmdlet retrieves the Windows PowerShell Desired State Configuration (DSC) resources present on the computer. This cmdlet discovers only the resources installed in the PSModulePath. It shows the details about built-in and custom providers, which are created by the user. This cmdlet also shows details about composite resources, which are other configurations that are packaged as module or created at run time in the session.

Parameters
-Module [<Object>]

Specifies the name or fully qualified name of the module for which to view the DSC resource.

-Name [<String[]>]

Specifies an array of names of the DSC resource to view.

-Syntax [<SwitchParameter>]

Indicates that the cmdlet returns the syntax view of the specified DSC resources. The returned syntax shows how to use the resources in aWindows PowerShell script.

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,ErrorAction, ErrorVariable, WarningAction, WarningVariable,OutBuffer, PipelineVariable, and OutVariable.

Outputs

Microsoft.PowerShell.DesiredStateConfiguration.DscResourceInfo

Examples
  1. Get all resources on the local computer:
    PS C:>  Get-DscResource
    

    This command gets all the resources on the local computer.

  2. Get a resource by specifying the name:
    PS C:>  Get-DscResource -Name "WindowsFeature"
    

    This command gets the WindowsFeature resource.

  3. Get all the resources from a module:
    PS C:> Get-DscResource -Module "xHyper-V"
    

    This command gets all the resources from the xHyper-V module.

  4. Get a resource by using wildcard characters:
    PS C:>  Get-DscResource -Name P*,r*
    

    This command gets all resources that match the wildcard pattern specified by the Name parameter.

  5. Get a resource syntax:
    PS C:>  Get-DscResource -Name "WindowsFeature" -Syntax
    

    This command gets the WindowsFeature resource, and shows the syntax for the resource.

  6. Get all the properties for a resource:
    PS C:>  Get-DscResource -Name "User" | Select-Object -ExpandProperty Properties
    

    This command gets the User resource, and then uses the pipeline operator to return all the properties for the User resource.

  7. Get all the resources from a specified module with a specified version:
    PS C:> Get-DscResource -Module @{ModuleName='xHyper-V';RequiredVersion='3.0.0.0'}
    

    This command gets all the resources from xHyper-V module with version 3.0.0.0.

Related Links

Find-DscResource
Invoke-DscResource