-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Invoke-DSCResource #5302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sdwheeler
merged 16 commits into
MicrosoftDocs:staging
from
theJasonHelmick:Invoke-DSCResource
Jan 11, 2020
Merged
Invoke-DSCResource #5302
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
bf41d2a
Merge branch 'staging' of https://github.com/MicrosoftDocs/PowerShell…
theJasonHelmick 0568e3d
Merge branch 'staging' of https://github.com/MicrosoftDocs/PowerShell…
theJasonHelmick d8419ec
Merge branch 'staging' of https://github.com/MicrosoftDocs/PowerShell…
theJasonHelmick db6ff3b
Merge branch 'staging' of https://github.com/MicrosoftDocs/PowerShell…
theJasonHelmick a338f58
Merge branch 'staging' of https://github.com/MicrosoftDocs/PowerShell…
theJasonHelmick e2bac9d
Merge branch 'staging' of https://github.com/MicrosoftDocs/PowerShell…
theJasonHelmick 313827e
added [wip] Whats new PowerShell 7.0
theJasonHelmick 30e5155
fixed format issue line 268
theJasonHelmick ee2344d
fixed format issue line 268
theJasonHelmick 4716750
Merge branch 'staging' of https://github.com/MicrosoftDocs/PowerShell…
theJasonHelmick b46dd1c
removed Whats NEw from Staging
theJasonHelmick 17c64df
Merge branch 'staging' of https://github.com/MicrosoftDocs/PowerShell…
theJasonHelmick c6b3def
update invoke-dscResource to 7.0
theJasonHelmick 8ed6d37
update to invoke-dscresource for 7.0
theJasonHelmick 1781a97
update invoke-dscresource
theJasonHelmick a005980
Update reference/7.0/PSDesiredStateConfiguration/Invoke-DscResource.md
theJasonHelmick File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
166 changes: 166 additions & 0 deletions
166
reference/7.0/PSDesiredStateConfiguration/Invoke-DscResource.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,166 @@ | ||
| --- | ||
| external help file: Microsoft.Windows.DSC.CoreConfProviders.dll-help.xml | ||
| keywords: powershell,cmdlet | ||
| locale: en-us | ||
| Module Name: PSDesiredStateConfiguration | ||
| ms.date: 01/10/2020 | ||
| online version: https://docs.microsoft.com/powershell/module/psdesiredstateconfiguration/invoke-dscresource?view=powershell-7&WT.mc_id=ps-gethelp | ||
| schema: 2.0.0 | ||
| title: Invoke-DscResource | ||
| --- | ||
|
|
||
| # Invoke-DscResource | ||
|
|
||
| ## SYNOPSIS | ||
| Runs a method of a specified PowerShell Desired State Configuration (DSC) resource. | ||
|
|
||
| ## SYNTAX | ||
|
|
||
| ``` | ||
| Invoke-DscResource [-Name] <String> [-Method] <String> -ModuleName <ModuleSpecification> -Property <Hashtable> | ||
| [<CommonParameters>] | ||
| ``` | ||
|
|
||
| ## DESCRIPTION | ||
|
|
||
| The `Invoke-DscResource` cmdlet runs a method of a specified PowerShell Desired State Configuration | ||
| (DSC) resource. | ||
|
|
||
| This cmdlet invokes a DSC resource directly, without creating a configuration document. | ||
| Using this cmdlet, configuration management products can manage windows or Linux by using DSC resources. | ||
| This cmdlet also enables debugging of resources when the DSC engine is running with debugging enabled. | ||
|
|
||
| ## EXAMPLES | ||
|
|
||
| ### Example 1: Invoke the Set method of a resource by specifying its mandatory properties | ||
|
|
||
| This command invokes the **Set** method of a resource named Log and specifies a **Message** property | ||
| for it. | ||
|
|
||
| ```powershell | ||
| Invoke-DscResource -Name Log -Method Set -ModuleName PSDesiredStateConfiguration -Property @{ | ||
| Message = 'Hello World' | ||
| } | ||
| ``` | ||
|
|
||
| ### Example 2: Invoke the Test method of a resource for a specified module | ||
|
|
||
| This command invokes the **Test** method of a resource named WindowsProcess, which is in the module | ||
| named **PSDesiredStateConfiguration**. | ||
|
|
||
| ```powershell | ||
| $SplatParam = @{ | ||
| Name = 'WindowsProcess' | ||
| ModuleName = 'PSDesiredStateConfiguration' | ||
| Property = '@{Path = 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'; Arguments = ''}' | ||
| Method = Test | ||
| } | ||
|
|
||
| Invoke-DscResource @SplatParam | ||
| ``` | ||
|
|
||
| ## PARAMETERS | ||
|
|
||
| ### -Method | ||
|
|
||
| Specifies the method of the resource that this cmdlet invokes. The acceptable values for this | ||
| parameter are: **Get**, **Set**, and **Test**. | ||
|
|
||
| ```yaml | ||
| Type: String | ||
| Parameter Sets: (All) | ||
| Aliases: | ||
| Accepted values: Get, Set, Test | ||
|
|
||
| Required: True | ||
| Position: 1 | ||
| Default value: None | ||
| Accept pipeline input: True (ByPropertyName) | ||
| Accept wildcard characters: False | ||
| ``` | ||
|
|
||
| ### -ModuleName | ||
|
|
||
| Specifies the name of the module from which this cmdlet invokes the specified resource. | ||
|
|
||
| ```yaml | ||
| Type: ModuleSpecification | ||
| Parameter Sets: (All) | ||
| Aliases: | ||
|
|
||
| Required: True | ||
| Position: Named | ||
| Default value: None | ||
| Accept pipeline input: True (ByPropertyName) | ||
| Accept wildcard characters: False | ||
| ``` | ||
|
|
||
| ### -Name | ||
|
|
||
| Specifies the name of the DSC resource to start. | ||
|
|
||
| ```yaml | ||
| Type: String | ||
| Parameter Sets: (All) | ||
| Aliases: | ||
|
|
||
| Required: True | ||
| Position: 0 | ||
| Default value: None | ||
| Accept pipeline input: True (ByPropertyName) | ||
| Accept wildcard characters: False | ||
| ``` | ||
|
|
||
| ### -Property | ||
|
|
||
| Specifies the resource property name and its value in a hash table as key and value, respectively. | ||
|
|
||
| ```yaml | ||
| Type: Hashtable | ||
| Parameter Sets: (All) | ||
| Aliases: | ||
|
|
||
| Required: True | ||
| Position: Named | ||
| Default value: None | ||
| Accept pipeline input: True (ByPropertyName) | ||
| Accept wildcard characters: False | ||
| ``` | ||
|
|
||
| ### CommonParameters | ||
|
|
||
| This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, | ||
| -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, | ||
| -WarningAction, and -WarningVariable. For more information, see | ||
| [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). | ||
|
|
||
| ## INPUTS | ||
|
|
||
| ## OUTPUTS | ||
|
|
||
| ### Microsoft.Management.Infrastructure.CimInstance, System.Boolean | ||
|
|
||
| ## NOTES | ||
|
|
||
| Previously, Windows PowerShell 5.1 resources ran under System context unless specified | ||
| with user context using the key **PsDscRunAsCredential**. In PowerShell 7.0, Resources run in the | ||
| user's context, and **PsDscRunAsCredential** is no longer supported. Previous configurations using | ||
| this key will throw an exception. | ||
|
|
||
| ## RELATED LINKS | ||
|
|
||
| [Windows PowerShell Desired State Configuration Overview](/powershell/scripting/dsc/overview/dscforengineers) | ||
|
|
||
| [Get-DscConfiguration](Get-DscConfiguration.md) | ||
|
|
||
| [Get-DscConfigurationStatus](Get-DscConfigurationStatus.md) | ||
|
|
||
| [Get-DscResource](Get-DscResource.md) | ||
|
|
||
| [Restore-DscConfiguration](Restore-DscConfiguration.md) | ||
|
|
||
| [Set-DscLocalConfigurationManager](Set-DscLocalConfigurationManager.md) | ||
|
|
||
| [Start-DscConfiguration](Start-DscConfiguration.md) | ||
|
|
||
| [Test-DscConfiguration](Test-DscConfiguration.md) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.