Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: Using dsc – how can you deploy files related to existing services?

$
0
0

Jacob Benson wrote:There is also a Service resource. So, what you can do is to leverage the Service and File Resources using the DependsOn Property so that it stops the services, copies the files, and then starts the services. So it could look like something like this.

Configuration MyApp
 
{
 
    node ServerA
    {
        Service StopService1
        {
            Name = "Service1″
            State = "Stopped"
        }
 
        File CopyFiles1
        {
            SourcePath = "\\FileServer1\Files"
            DestinationPath = "ServerA\Service1\Files"
            Recurse = $True
            DependsOn = "[Service]Service1″
        }
 
        Service StartService1
        {
            Name = "Service1″
            State = "Running"
            DependsOn = "[File]CopyFiles1″
        }
    }
 
}

Just seeing if I understand this right, but in a pull scenario wouldn't the above restart the service every 15 minutes (or is it 30) since the service stop condition has no dependencies? It's almost like you'd need the service stop resource to depend inversely on the file copy resource. i.e. only stop the service if the file copy test fails. Right?


Viewing all articles
Browse latest Browse all 13067

Trending Articles