Skip to content

Latest commit

 

History

History
133 lines (110 loc) · 2.67 KB

ConvertTo-DscJson.md

File metadata and controls

133 lines (110 loc) · 2.67 KB
external help file GeneratedBy Module Name online version schema
PSDSC-help.xml
Sampler update_help_source task
PSDSC
2.0.0

ConvertTo-DscJson

SYNOPSIS

Convert DSC Configuration (v1/v2) Document to JSON.

SYNTAX

Path (Default)

ConvertTo-DscJson -Path <String> [-ProgressAction <ActionPreference>] [<CommonParameters>]

Content

ConvertTo-DscJson -Content <String> [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

The function ConvertTo-DscJson converts a DSC Configuration Document (v1/v2) to JSON.

EXAMPLES

EXAMPLE 1

$path = 'myConfig.ps1'
PS C:\> ConvertTo-DscJson -Path $path

PARAMETERS

-Path

The file path to a valid DSC Configuration Document.

Type: String
Parameter Sets: Path
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Content

The content to a valid DSC Configuration Document.

Type: String
Parameter Sets: Content
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
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.

INPUTS

Input a valid DSC Configuration Document

configuration MyConfiguration {

Import-DscResource -ModuleName PSDesiredStateConfiguration

Node localhost

{

Environment CreatePathEnvironmentVariable

{

Name = 'TestPathEnvironmentVariable'

Value = 'TestValue'

Ensure = 'Present'

Path = $true

Target = @('Process')

}

}

}

OUTPUTS

Returns a JSON string

{

"resources": {

"name": "MyConfiguration node",

"type": "Microsoft.DSC/PowerShell",

"properties": {

"resources": [

{

"name": "CreatePathEnvironmentVariable",

"type": "PSDscResources/Environment",

"properties": {

"Value": "TestValue",

"Path": true,

"Name": "TestPathEnvironmentVariable",

"Ensure": "Present",

"Target": [

"Process"

]

}

}

]

}

}

}

NOTES

RELATED LINKS