System Administrator tasks with Elixir

Hello all,

I am in the process of learning Elixir. Knowing that there is nothing like a real, not too complicated, project to get anyone started I was wondering if Elixir is a suitable (note that I am not saying the best) approach to perform Windows administration tasks.

Let me explain. Part of what I do involves installing applications on many Windows servers. I already put together Powershell scripts that do the following:

  1. Check for prerequisites: OS Version, third party requirements, drives sizes, etc.
  2. Execute the actual package installers passing along options for silent installs.
  3. Test the installation by calling some Web services the application exposes and test their result.

I know step 3 is not a problem to do with Elixir but I am not sure about 1 and 2. I played a bit with Erlang os module and it kind of does some of the things although I got some strange results (like when testing if a file exist - it returns false even when the file is clearly there - I guess it is just something I am not doing right).

In any case, this would be just a little project for myself to get familiar with Elixir. Do you guys have any advice on how to get started (e.g. modules to look at)? Or am I picking the wrong tasks to play with Elixir in the first place?

Thanks very much

1 Like

Uhh, that does not sound right, do you have a test-case showing this? o.O?

Hi @OvermindDL1,

Thanks very much for the reply. Do not worry about my example, it is probably me doing something wrong, I am just getting familiar with Elixir and Erlang.

Thanks again

1 Like

Elixir would not be my first choice for a sysadmin tool, but what you’re describing is certainly possible. I suspect most of what’d you write would be calls out to external programs and parsing the strings you get back. I’d be more enthusiastic if it was on Unix rather than Windows, but that may just be my personal bias.

Where Elixir shines is when you have a tool X and you need to run X on thousands of machines and manage the results.

Hi @bbense,

Thanks very much for your reply. I agree with you … 99% :smile:. It is usually more fun on Linux (however, most of my customers use Windows servers and, in all fairness, latest server versions are quite impressive) and Elixir is not quite the straightforward choice for what I describe. I am simply trying to use the excuse of doing what I have to do for work anyway to learn Elixir along. It is kind of killing two birds with the same stone.

That being said, let us say I want to run “myWindowsProcess.exe /aBunchofArguments.txt”. What would be the right approach?. So far I have seen Porcelain whcih allows me to do something like:

File.write!("aBunchofArguments.txt", _)
result = Porcelain.exec("myWindowsProcess.exe", ["aBunchofArguments.txt"])

I am still trying to figure out / test the details. (Did I mention I am a telecommunications guy, not a hard core developer? :wink: - that is what brought me fist to Erlang and then to Elixir) Very simple coding things become a project in itself for now, quite challenging and exciting at the same time.

Thanks again for your reply, it is very much appreciated.

Well, you’ve already found my second suggestion. Porcelain helps a lot with the rough edges of Ports.

Elixir actually has pretty good support for the basics of moving up/down directories and manipulating file paths. It’s my understanding that you can just “pretend” it’s unix and the libraries will do the correct thing on Windows, but I haven’t verified that.