This article is Part 5 in a 9-Part series about POSHOrigin, a PowerShell module that aims to assist you in managing your Infrastructure via custom PowerShell DSC resources.
- Part 1 - POSHOrigin - Summary
- Part 2 - POSHOrigin - Installation
- Part 3 - POSHOrigin - Configuration File
- Part 4 - POSHOrigin - Defaults File
- Part 5 - POSHOrigin - Load, Test, and Execute Configurations <<
- Part 6 - POSHOrigin - Sharing Configurations
- Part 7 - POSHOrigin - Credential Resolvers
- Part 8 - POSHOrigin - Examples
- Part 9 - POSHOrigin - Wrapping Up
Loading Configurations
You load POSHOrigin configurations by calling the Get-POSHOriginConfig function and specifying the file, files, or folder to process. You can recursively process subfolders as well. Get-POSHOriginConfig returns one or more custom objects that can then be converted into DSC configurations.
Testing Configurations
You can test your infrastructure for compliance against your configuration by calling the Invoke-POSHOrigin function with the -WhatIf switch. Internally, POSHOrigin will execute the Test-DscConfiguration DSC cmdlet against the MOF file that is compiled.
NO RESOURCES WILL BE CREATED, DELETED, OR MODIFIED when using the -WhatIf switch.
1
2
3
$myConfig = Get-POSHOriginConfig -Path '.\vm_config.ps1' -Verbose
Invoke-POSHOrigin -ConfigData $myConfig -Verbose -WhatIf
Get-POSHOriginConfig -Path '.\vm_config.ps1' -Verbose | Invoke-POSHOrigin -Verbose -WhatIf
Executing Configurations
You can execute your POSHOrigin configuration by calling the Invoke-POSHOrigin function. Internally, POSHOrigin will execute the Start-DscConfiguration DSC cmdlet against the MOF file that is compiled.
RESOURCES WILL BE CREATED, DELETED, OR MODIFIED. You should run Invoke-POSHOrigin with the -WhatIf prior to this in order to get an idea of changes will occur.
1
2
$myConfig = Get-POSHOriginConfig -Path '.\vm_config.ps1' -Verbose
Invoke-POSHOrigin -ConfigData $myConfig -Verbose
Cheers