https://github.com/duffney/invokedsc
PowerShell module for Invoking DSC from json
https://github.com/duffney/invokedsc
dsc powershell powershell-dsc
Last synced: 6 months ago
JSON representation
PowerShell module for Invoking DSC from json
- Host: GitHub
- URL: https://github.com/duffney/invokedsc
- Owner: duffney
- License: mit
- Created: 2017-04-06T13:41:58.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-12-28T19:00:25.000Z (about 8 years ago)
- Last Synced: 2025-06-03T20:59:26.847Z (8 months ago)
- Topics: dsc, powershell, powershell-dsc
- Language: PowerShell
- Size: 96.7 KB
- Stars: 17
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://ci.appveyor.com/project/Duffney/invokedsc)
# InvokeDSC
InvokeDSC is a JSON based DSL for creating and managing infrastructure with DSC resources.
## Overview
Allows you to declaratively define your infrastructure within JSON configuration documents. InvokeDSC converts those json documents to PSCustomObjects that Invoke-DSCResource can consume. By doing this it removes the need for PowerShell configuration documents and the .mof documents it generates. Which results in more flexibility and removes the need of a single .mof document that declares the end state of your infrastructure.

## JSON Configuration File
```JSON
{
"Modules":{
"xPSDesiredStateConfiguration":"8.0.0.0"
},
"DSCResourcesToExecute":{
"DevOpsGroup":{
"dscResourceName":"xGroup",
"GroupName":"DevOps",
"ensure":"Present"
}
}
}
```
## Commands
* ConvertTo-Dsc
* Invoke-Dsc
* Invoke-DscConfiguration
## Examples
### Invoke-DscConfiguration
```PowerShell
Invoke-DscConfiguration -Path 'c:\config.json'
```
```PowerShell
$config = @"
{
"Modules":{
"xPSDesiredStateConfiguration":"8.0.0.0"
},
"DSCResourcesToExecute":{
"DevOpsGroup":{
"dscResourceName":"xGroup",
"GroupName":"DevOps",
"ensure":"Present"
}
}
}
"@
Invoke-DscConfiguration -InputObject $config
```
### ConvertTo-Dsc
```PowerShell
ConvertTo-Dsc -Path 'c:\json\example.json'
```
```PowerShell
$config = @"
{
"Modules":{
"xPSDesiredStateConfiguration":"8.0.0.0"
},
"DSCResourcesToExecute":{
"DevOpsGroup":{
"dscResourceName":"xGroup",
"GroupName":"DevOps",
"ensure":"Present"
}
}
}
"@
ConvertTo-Dsc -InputObject $config
```
### Invoke-Dsc
```powershell
$r = ConvertTo-Dsc -Path 'c:\config.json'
Invoke-Dsc -Resource $r
```
### Credits
[POSHOrigin](https://github.com/devblackops/POSHOrigin) by [Brandon Olin](https://github.com/devblackops)
[Ansible-win_dsc](https://github.com/trondhindenes/Ansible-win_dsc) by [Trond Hindenes](https://github.com/trondhindenes)
[Steven Murawski](https://github.com/smurawski)
[Jaigene Kang](https://twitter.com/prattlesnake)