Windows PowerShell command on Get-command Invoke-DscResource
MyWebUniversity

Windows PowerShell command on Get-command Invoke-DscResource

NAME

Invoke-DscResource

SYNOPSIS

Runs a method of a specified DSC resource.

SYNTAX

Invoke-DscResource [-Name] [-Method] {Get | Set | Test} -ModuleName -Property

[]

DESCRIPTION

The Invoke-DscResource cmdlet runs a method of a specified Windows PowerShell Desired State Configuration (DSC)

resource. Before you run this cmdlet, set the refresh mode of the Local Configuration Manager (LCM) to Disabled. This cmdlet invokes a DSC resource directly, without creating a configuration document. Using this cmdlet, configuration management products can manage windows by using DSC resources. This cmdlet also enables debugging of resources when the DSC engine or LCM is running with debugging enabled.

PARAMETERS

-Method

@{Text=} Required? true Position? 1 Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false

-ModuleName

@{Text=} Required? true Position? named Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false

-Name

@{Text=} Required? true Position? 0 Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false

-Property

@{Text=} Required? true Position? named Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).

INPUTS

OUTPUTS

Microsoft.Management.Infrastructure.CimInstance, System.Boolean

NOTES

Example 1: Invoke the Set method of a resource by specifying its mandatory properties

PS C:\>Invoke-DscResource -Name Log -Method Set -Property @{Message = 'Hello World'}

This command invokes the Set method of a resource named Log and specifies a Message property for it.

Example 2: Invoke the Test method of a resource for a specified module

PS C:\>Invoke-DscResource -Name WindowsProcess -Method Test -Property @{Path =

'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'; Arguments = ''} -ModuleName

PSDesiredStateConfiguration

This command invokes the Test method of a resource named WindowsProcess, which is in the module named

PSDesiredStateConfiguration.

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/?LinkId=627544

Windows PowerShell Desired State Configuration Overview http://go.microsoft.com/fwlink/?LinkID=311940

Get-DscConfiguration

Get-DscConfigurationStatus

Get-DscResource

Restore-DscConfiguration

Set-DscLocalConfigurationManager

Start-DscConfiguration

Test-DscConfiguration



Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 OurUNIX.com ™