Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Executing a Powershell Script in Fake

What is the best way to go about executing a Powershell script in the Fake build automation tool ?

I feel that there should be an obvious answer to this question, but have not been able to find anything by searching.

like image 337
Adrian Russell Avatar asked Apr 28 '14 21:04

Adrian Russell


1 Answers

As you mention in your comment, using the PowerShell class makes this very easy.

#r "FakeLib.dll"
#r "System.Management.Automation"

open Fake
open System.Management.Automation

Target "RunSomePowerShell" <| fun _ ->
    PowerShell.Create()
      .AddScript("(Get-Process | ? ProcessName -eq 'chrome' | measure WorkingSet -Average).Average")
      .Invoke()
      |> Seq.iter (printfn "%O")
like image 167
Leaf Garland Avatar answered Sep 19 '22 17:09

Leaf Garland