Export (0) Print
Expand All

Get-DscResource

Windows PowerShell 4.0

Updated: October 17, 2013

Applies To: Windows 8.1, Windows PowerShell 4.0, Windows Server 2012 R2

Get-DscResource

Gets Desired State Configuration resources present on the computer.

Syntax

Parameter Set: Default
Get-DscResource [[-Name] <String[]> ] [-Syntax] [ <CommonParameters>]




Detailed Description

The Get-DscResource cmdlet retrieves the Desired State Configuration resources present on the computer. It shows built-in and custom providers (created by the user), as well as composite resources (other configurations that are packaged as module or created at run time in the session).

Parameters

-Name<String[]>

Specifies an array of names of the Desired State Configuration resource to view.


Aliases

none

Required?

false

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue, ByPropertyName)

Accept Wildcard Characters?

true

-Syntax

Indicates that the cmdlet returns the syntax view of the specified Desired State Configuration resources. The returned syntax shows how to use the resources in a Windows PowerShell® script.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Microsoft.PowerShell.DesiredStateConfiguration.DscResourceInfo

Examples

Example 1: Get all resources on the local computer

This command gets all the resources on the local computer.


PS C:\> Get-DscResource

Example 2: Get a resource by specifying the name

This command gets the WindowsFeature resource.


PS C:\> Get-DscResource –Name WindowsFeature

Example 3: Get a resource by using wildcard characters

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


PS C:\> Get-DscResource –Name P*,r*

Example 4: Get a resource syntax

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


PS C:\> Get-DscResource -Name WindowsFeature -Syntax

Example 5: Get all the properties for a resource

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


PS C:\> Get-DscResource User | Select-Object -ExpandProperty Properties

Related topics

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft