Giter Club home page Giter Club logo

xdschelper's Introduction

Build status

xDscHelper

A DSC resource module that contains helper resources not fitting elsewhere. All of the resources in this repository are provided AS IS.

Installation

To install xDscHelper module either

  • Unzip the content under $env:ProgramFiles\WindowsPowerShell\Modules folder
  • Or Install-Module xDscHelper in an elevated PowerShell session

Run Get-DSCResource to see that xDscHelper is among the DSC Resources listed

Requirements This module requires at least PowerShell v4.0, which ships in Windows 8.1 or Windows Server 2012R2.

Description

The module xDscHelper contains the following resources:

  • xWaitForItem - Allows you to wait for files to reach a specific length or content or for folders reach a specified amount of child items
  • xMaintenanceWindow - Allows you to specify a maintenance window as a dependency for your resources
  • Warning: This will screw up your reporting unless you can exclude the xMaintenanceWindow resources. xMaintenanceWindow throws an error in the Set-TargetResource operation in order to stop dependecy processing. This means: Your configuration cannot be applied.

Examples

This example for xWaitForItem waits for a hypothetic configuration file created by another system, process or product which a local service depends on:

configuration conf
{
    Import-DscResource -ModuleName xDscHelper

    node localhost
    {
        # Wait for a third party product or another system to create a file you need
        xWaitForItem configFile
        {
            Path = 'C:\ConfigFileFromOtherSystem.ini'
            Type = 'File'
            MinimumLength = 1
        }

        # Use it as a dependency
        Service myService
        {
           Name = 'IniNeedingService'
           Path = 'C:\Svc\My.exe'
           DependsOn = '[xWaitForItem]configFile'
        }
    }
}

This example for xWaitForItem waits for a folder to fully replicate it's contents:

configuration conf
{
    Import-DscResource -ModuleName xDscHelper

    node localhost
    {
        # Wait for e.g folder replication
        xWaitForItem folderContents
        {
            Path = 'C:\SomeReplicatedFolder'
            Type = 'Directory'
            ChildItemCount = 25
        }

        # Use it as a dependency
        Service myService
        {
           Name = 'FileNeedingService'
           Path = 'C:\Svc\My.exe'
           DependsOn = '[xWaitForItem]folderContents'
        }
    }
}

This example for xMaintenanceWindow defines a maintenance window for the second tuesday of each month from 10 pm to 6 am and uses it as a dependency for other resources:

configuration conf
{
    Import-DscResource -ModuleName xDscHelper

    node localhost
    {
        xMaintenanceWindow patchday
        {
            ScheduleStart = (Get-Date).Date.AddHours(22)
            ScheduleEnd = (Get-Date).Date.AddHours(6)
            ScheduleType = 'Monthly'
            DayOfWeek = 'Tuesday'
            DayOfMonth = 2
        }

        Package 1
        {
            DependsOn = '[xMaintenanceWindow]patchday'
            ...
        }

        Package 2
        {
            DependsOn = '[xMaintenanceWindow]patchday'
            ...
        }

        Package 3
        {
            DependsOn = '[xMaintenanceWindow]patchday'
            ...
        }
    }
}

xdschelper's People

Contributors

nyanhp avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.