Command Line Reference - wiltaylor/FCE GitHub Wiki

Introduction

All of the interactions with FCE will be via the config.ps1 script rather than the FlexibleConfigurationEngine.exe script. This is by design. The main reason for this is it allows you to only have to incldue config.ps1 and config.csx in source control.

The script gives you the ability to do the following:

Apply configuration

config.ps1 -Apply

This runs through the configuration script and applies all changes specified.

Optional Parameters:

-Script (path)

Lets you specify a csx file that contains your configuration script to run. By default this is set to config.csx.

-Settings

Lets you specify a json file containing optional settings. These settings are copied into the datastore as ConfigSettings. This can be useful if you want to reuse the same configuration script on multiple systems and change properties.

Test configuration

config.ps1 -Test

This mode runs through the config script like Apply does but it only reports on the state. You can use this to tell you what the script will change.

Optional Parameters:

-Script (path)

Lets you specify a csx file that contains your configuration script to run. By default this is set to config.csx.

-Settings

Lets you specify a json file containing optional settings. These settings are copied into the datastore as ConfigSettings. This can be useful if you want to reuse the same configuration script on multiple systems and change properties.

Validate

config.ps1 -Validate

This switch will validate the config.csx script and tell you if there are any syntax errors in it.

Gather

config.ps1 -Gather

This will only run the gathers in a script and completely ignore configuration items. It will also save the results of the gather to gather.json in the same directory as config.csx. This can be useful for doing an inventory of a system instead of configuring it or debugging what gatherers are capturing.

Optional Parameters:

-Script (path)

Lets you specify a csx file that contains your configuration script to run. By default this is set to config.csx.

-Output

Changes the location of where the results are stored. By default this is set to gather.json in the same directory as config.csx.

Clean

config.ps1 -Clean

This will remove the FCE and Package directory from the directory. This is useful if you want to clean up all the temporary files created during the configuration run. It also removes any log files or fce.zip files. This can also be used to repair the directory in the event FCE becomes corrupt.

Version

config.ps1 -Version

This displays the version information for CFE.

Return Data

Return Codes:

There are 3 return codes that CFE will return (the powershell script forwards them so you can check for them):

0 - The run went ok. This means all configuration items are not in configured state. 500 - There was an error while running. This generally happens if a config returns Unconfigured state after having its applied action run. 3010 - The configuration script has halted due to a reboot being required. This lets you control when the system reboots from outside the configuration. If you don't want to do this you can use a property to force CFE to reboot the system for you.

Files

FCE will also create a number of files in the same directory you can looks at.

fce-*.log - There will be log files with the current date stamp on them created in the directory. You can use these to troubleshoot issues with scripts failing to run.

data.json - This is where presistant data is stored by FCE, this can be used to keep information between runs or reboots. This is mostly done for Reboot commands to prevent them running multiple times. It is recommended you don't touch this file manually.

result.json - This file contains all the states of all the configuration items run. You can use this to get more information on what failed or parse it with a script if the return codes don't give you enough information.