Opens a configuration set from a file or history.
Syntax
From File (Default)
Get-WinGetConfiguration
- File < string >
[ - ModulePath < string > ]
[ - ProcessorPath < string > ]
[ < CommonParameters > ]
From History
Get-WinGetConfiguration
- InstanceIdentifier < string >
[ - ModulePath < string > ]
[ - ProcessorPath < string > ]
[ < CommonParameters > ]
All from History
Get-WinGetConfiguration
- All
[ - ModulePath < string > ]
[ - ProcessorPath < string > ]
[ < CommonParameters > ]
Description
The Get-WinGetConfiguration cmdlet opens and loads a configuration set from a file or from configuration history. The configuration set can then be passed to Invoke-WinGetConfiguration to apply it to the system, or to Get-WinGetConfigurationDetails to retrieve detailed information.
Parameters
The path to the configuration file (YAML format) to load. Pipeline Input: true (by property name)
Parameter Set: OpenConfigurationSetFromFile
Position: 0
Required: true
The instance identifier (GUID) of a configuration set from history. Pipeline Input: true (by property name)
Parameter Set: OpenConfigurationSetFromHistory
Position: 0
Required: true
Retrieve all configuration sets from history. Parameter Set: OpenAllConfigurationSetsFromHistory
Required: true
Custom location to install PowerShell modules required by the configuration. Pipeline Input: true (by property name)
Position: 1
Custom path to the DSCv3 processor executable. Pipeline Input: true (by property name)
Outputs
A configuration set that can be applied or inspected. The name of the configuration set.
The unique identifier for this configuration set instance.
The origin of the configuration set.
The file path or source of the configuration set.
The schema version of the configuration.
Examples
Example 1: Load Configuration from File
$config = Get-WinGetConfiguration - File "C:\config\setup.yaml"
Loads a configuration set from a YAML file.
Example 2: Load and Apply
Get-WinGetConfiguration - File "setup.yaml" | Invoke-WinGetConfiguration - AcceptConfigurationAgreements
Loads a configuration and applies it via the pipeline.
Example 3: Load from History
$config = Get-WinGetConfiguration - InstanceIdentifier "12345678-1234-1234-1234-123456789012"
Loads a previously applied configuration from history using its instance identifier.
Example 4: Get All Configurations from History
$configs = Get-WinGetConfiguration - All
$configs | Select-Object Name , InstanceIdentifier , Source
Retrieves all configuration sets from history and displays their properties.
Example 5: Load with Custom Module Path
$config = Get-WinGetConfiguration - File "setup.yaml" - ModulePath "C:\CustomModules"
Loads a configuration and installs required modules to a custom location.
Example 6: Load with Custom Processor
$config = Get-WinGetConfiguration - File "setup.yaml" - ProcessorPath "C:\DSC\processor.exe"
Loads a configuration using a custom DSC processor.
Example 7: Load and Inspect
$config = Get-WinGetConfiguration - File "setup.yaml"
$config | Format-List Name , Origin , SchemaVersion
Loads a configuration and displays its properties.
Example 8: Load Relative Path
$config = Get-WinGetConfiguration - File ".\configs\dev-setup.yaml"
Loads a configuration from a relative path.
Example 9: Error Handling
try {
$config = Get-WinGetConfiguration - File "setup.yaml" - ErrorAction Stop
Write-Host "Configuration loaded: $( $config .Name ) "
}
catch {
Write-Error "Failed to load configuration: $_ "
}
Loads a configuration with error handling.
Example 10: Load and Get Details
$config = Get-WinGetConfiguration - File "setup.yaml"
$details = Get-WinGetConfigurationDetails - Set $config
$details
Loads a configuration and retrieves its detailed information.
Notes
Alias: gwgc
Configuration files must be in YAML format
The cmdlet validates the configuration schema
Use -ModulePath to control where PowerShell modules are installed
Use -ProcessorPath to specify a custom DSC processor
History feature stores previously applied configurations