This project is read-only.

Development Help

Visual Studio 2010

The project is only designed for Visual Studio 2010 but if you just want to build it you can probably run the build.bat file anyways and it should work as long as you have one version of Visual Studio installed. The build.bat file uses msbuild.exe so it shouldn't depend too much on the version of Visual Studio but it hasn't been tested with anything other than VS 2010.


Compiling the project will now cause the service to start as an console app for simplified testing. Make sure the project is compiled as Release before installing. Using the build.bat script will ensure the project is build as release, this is the recommended method of building the project.


Please do not build the project using the solution. Make sure to run with build.bat it performs extra steps that the solution will not perform. The build script uses NAnt underneath but you shouldn't need to install anything included in the \Tools\ folder is a copy of NAnt. There are some custom NAnt modules that are used in the build script to compile a project in the solution you can find them under \Tools\nant\extensions\common\2.0. No source code is provided for these modules but if you would like a copy please let me know and i can provide you with a copy.

If you're going to update NAnt for whatever reason please be sure to re-configure NAnt to use .NET 4.0 Framework, NAnt is not configured to use .NET 4.0 by default changes need to be made to the config file.


If you have any questions please feel free to contact me.


Configuring Powershell

  1. Install powershell v2.0
  2. To configure powershell to allow script execution open powershell and run the following command
Set-ExecutionPolicy Unrestricted


  1. Verify the user running the powershell script has permission to create RegistryKeys in HKLM\SYSTEM\CurrentControlSet\services\CloudInit\Settings
  2. Copy source code to installation directory C:\Program Files\CloudInit.NET\ of your choice
    • CloudInit.exe
    • CloudInit.Modules.Core.dll
    • install.ps1
  3. Open powershell and change the working directory to the install directory
CD "C:\Program Files\CloudInit.NET\"
. .\install.ps1

Its important to know that the service must be set to start= delayed-auto because sometimes the scripts that it executes requires other windows services and if the start mode is set to automatic sometimes these services are not available and the script will not execute correctly.

The installation script adds two registry keys. These values can be changed by the user if required. If the keys are empty the service will not work, make sure they are either removed or updated to the correct value.
  • HKLM\SYSTEM\CurrentControlSet\services\CloudInit\Settings\UserDataFile
    • Value -
  • HKLM\SYSTEM\CurrentControlSet\services\CloudInit\Settings\LogFile
    • Value - C:\CloudInit.log
  • HKLM\SYSTEM\CurrentControlSet\services\CloudInit\Settings\SecureKey
    • Value - 3e3e2d3848336b7d3b547b2b55

Its recomended that you change the value of SecureKey as this key is used as the public key to encrypt and decrypt your files if you're using the PowershellIncludeEncryptedModule. If you're not using this module you do not need to change the SecretKey. Make sure that the SecretKey registry value is the same on the production machines as it is on the machine which encrypts the files.

If you experience any issues with the installation please make sure to check the event viewer for more information


There are two modules currently developed for CloudInit.NET a module is basically a rule on how to execute the contents of the file downloaded. The first thing the service does is download the content located in the UserDataFile and parse it for headers. Each header will cause the service to treat the the file differently. Below are the two modules currently built. If these two modules don't have all the features you required you can create your own modules and just copy the dll to the install directory.

Powershell Module

  • Header - #!
  • Execution - This module is simple. It just executes the content of the user-data file as a powershell script and saves the output the the LogFile.

Example Script

#! /powershell/

## Execute custom powershell code

# Set the CloudInit service to Disabled after the script is finished
# Because we only want this code to run once
Set-Service -Name CloudInit -StartupType Disabled 

Powershell Include Module

  • Header - #include
  • Execution - This file is downloaded and each line is treated as a separate downloadable powershell script. Each script is downloaded and executed in order.

Example Script


Powershell Include Encrypted Module

  • Header - #encrypted include
  • Execution - This file is downloaded and each line is treated as a separate downloadable powershell script. Each script is downloaded and executed in order. Before being executed the downloaded contents are decrypted using RijndaelManaged class. Its recommended to change the SecureKey value in the registry because the default value is public and your files would be easily decrypted by anyone else using this project.

Example Script

#encrypted include

Last edited Jan 27, 2012 at 6:50 PM by bwight4157, version 1


No comments yet.