0

In managing one of my applications, I need to distribute a small text file to a specific directory on a number of application servers and restart the service when a new version is pushed out. I have a fairly standard set of tools at my disposal, SCCM, AD/GPO, Orchestrator, and so forth.

What's the most operationally sustainable way to distribute this text file to these servers with the assumption that it will change periodically?

3 Answers 3

2

I would recommend a Desired State Configuration File Resource and Service Resource. Here is an example configuration I created:

Configuration UpdateApplicationFile
{
    Param ($computername, $sourcefilepath, $destination)

    node $computername
    {
        Service suspendservice
        {
            name = appservice
            State = paused
        }

        file applicationfile
        {
            ensure          = "present"
            type            = "file"
            sourcepath      = $sourcefilepath
            DestinationPath = $destination
            DependsOn       = "[service]suspendservice"
        }
        service startservice
        {
            name = appservice
            State = started
            DependsOn =  "[file]applicationfile"
        }


    }
}

DSC File Resource https://technet.microsoft.com/en-us/library/dn282129.aspx

0

I'd set a notification event and run a script to copy the file and restart the service. See https://gallery.technet.microsoft.com/scriptcenter/Powershell-FileSystemWatche-dfd7084b

Just set it and forget it. For things like this you might also want to add an event log entry as well

0

If using the Desired State Configuration File Resource as suggested by @Davidw, I recommend using the Checksum property as well (https://technet.microsoft.com/en-us/library/dn282129.aspx).

If you don't use the Checksum property, the file will never be updated because you're comparing only the file or directory name, which I'm assuming you're not changing when you make edits to the file. Specifying the Checksum property tells DSC to make a change if the SHA-1, SHA-256, SHA-512, createdDate, or modifiedDate is different.

On a related topic, using the single DSC file resource @Davidw recommends will work, but I recommend setting up DSC with a centralized web server so you can manage your files/states from a central distribution point (http://www.systemcentercentral.com/day-1-intro-to-powershell-dsc-and-configuring-your-first-pull-server/). It's easier to manage MOF files from a central point, otherwise you may lose track of the individual MOF file running on each server.

Full disclosure - I develop configuration management software for Windows that solves the above problem, but I also think these steps will work too.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .