Using a F # script to replace powershell in a production environment?

I used a powershell script to automate some tasks on production servers. However, it reaches its limit when I try to do something for asynchronous and parallel processing, etc.

Is F # script good for replacing powershell script? (Guess that this will be more cumbersome if the file system accesses and other other OS objects, which is very simple in Powershell). It is established that there is no visual studio on the servers. Is it enough to copy the fsi.exe file to the server to run the fsx files?

Using,

  • Download large zip files from a slow FTP server
  • Unzip files
  • Execute executable files to process unpacked files

each step takes some time, so I want to do something like the following, which is difficult to do in powershell

//Limit download 3 files at the same time maximum.
async {
  let! zip = GetFromFTP ...
  let! file = Unzip zip
  do! ... //Run exe to parse file
}
+4
source share
3 answers

F # script is not a good choice to replace powershell in general - as you already mentioned, F # is a much lower level language, so you will need to write a ton of more code to create the basic system automation tools. F # is also not so well integrated with other Windows server technologies, so this will be another battle uphill. If you really want to go this route, you must install the F # 3.1.2 bundle on your server, which will deploy the FSharp.Core runtime and LPS / FSI.

powershell F # .NET, , , F # DLL, powershell. Powershell F #. .

/ , , powershell .

: powershell/F #, , Powershell Type Provider.

+5

FAKE , fsi.exe. , .fsx , .

+5

F #, , , . , F # , , , . 20- script 20- F # script. , F #, , 1000 powershell, .. .

Powershell , , F #. , , .. FAKE. FAKE , , powershell.

So, if your goal is to write a few cp, mvand rmor anything else with existing cmdlets, you will be disappointed with F #. But if you write more complex processing, where the cmdlets are only input / output, you may be happy with F # in the end.

+2
source

All Articles