Skip to content

Get-Configuration

SYNOPSIS

Reads the content from configuration file(s) and returns as array of configuration objects.

SYNTAX

1
2
Get-Configuration [[-PsImportClientDirectory] <String>] [[-ConfigurationFile] <String[]>]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

The Get-Configuration function gets the contents of one or more configuration file, validates it against a schema and returns the content as a PSCustomObject in an array.

If a path to a directory is supplied via the PsImportClientDirectory parameter all configuration files in that is read, validated and returned as an array of PSCustomObjects.

If NO input is supplied via the PsImportClientDirectory parameter, the configuration files provided via the ConfigurationFile parameter is read, validated and returned as an array of PSCustomObjects.

If no configurations are found, the function returns an empty array.

EXAMPLES

EXAMPLE 1

1
Get-Configuration

In this example no input is provided and we will get back an empty array.

EXAMPLE 2

1
Get-Configuration -PsImportClientDirectory "Path\To\PSImportClient"

In this example we supply a custom directory which contains a directory called configurations. All configuration files will be returned as an array.

EXAMPLE 3

1
Get-Configuration -ConfigurationFile "Path\To\ConfigurationFile1.json", "Path\To\ConfigurationFile2.json"

In this example we specify what configuration we would like to be returned in the array.

PARAMETERS

-ConfigurationFile

Full path to one or more configuration files.

1
2
3
4
5
6
7
8
9
Type: String[]
Parameter Sets: (All)
Aliases:

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

-ProgressAction

Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.

The ProgressAction parameter takes one of the ActionPreference enumeration values: SilentlyContinue, Stop, Continue, Inquire, Ignore, Suspend, or Break.

1
2
3
4
5
6
7
8
9
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

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

-PsImportClientDirectory

Path to directory where the directory configurations lives.

1
2
3
4
5
6
7
8
9
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
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

System.String

String[]

OUTPUTS

System.Array

NOTES