Search code examples
powershellworkflow

Supress Powershell banner that appears when workflow executes?


I am running a workflow from within a Powershell script. When the workflow is invoked, I get this blue banner, which is unfortunately temporarily covering up useful text output from the calling script. I created this script as a test:

workflow foobar {
Param ($MountedDrives)
powershell -command C:\users\admin\desktop\Foobar2.ps1 $MountedDrives
}
$mountedDrives="D:"
foobar $mountedDrives

enter image description here

Is there any way to suppress the blue banner altogether? I have tried invoking the workflow with

workflow foobar {
powershell -windowstyle hidden -command foobar2.ps1
}

and also

workflow foobar {
powershell -nologo -command foobar2.ps1
}

Both execute the workflow but display the banner.


Solution

  • As @Olaf mentioned in the comments, the solution is to add

    $ProgressPreference='SilentlyContinue'
    

    Thus:

    workflow foobar {
      Param ($MountedDrives)
      $ProgressPreference = 'SilentlyContinue'
      powershell -command C:\users\admin\desktop\Foobar2.ps1 $MountedDrives
    }
    $mountedDrives = 'D:'
    foobar $mountedDrives