O'Reilly logo

Microsoft Operations Management Suite Cookbook by Chiyo Odika

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Running a runbook on hybrid worker

In this scenario, we will execute a fairly simple runbook on a hybrid worker. The runbook will look for all files in a directory specified in a runbook source parameter and copy to another hybrid worker directory specified in a runbook target parameter:

workflow File-Copy{     Param    (        [parameter(Mandatory=$true)]        [String] $FileSource,        [parameter(Mandatory=$true)]        [String] $FileDestination    )    Write-Output "Runbook is executing on On-premises Hybrid worker: $env:ComputerName"    Write-Output "File Destination: $FileDestination"    Write-Output "Source of File: $FileSource"     $execute = InlineScript    {        Try        {            Copy-Item -Path "$using:FileSource" -Destination "$using:FileDestination" -recurse        }        catch        { $errorMessage = $error[0].Exception.Message ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required