Posts

Showing posts from January, 2019

Configuring your systems and create a powershell script that can just be executed accross windows

So I needed a cross platform scripting language. I could have chosen bash and just used WSL but I prefer powershell over any other scripting language. Thank fully, Microsoft introduced Powershell core that's cross platform. The first thing I had to do was install powershell core on all my boxes. I follows the instructions from powershell core's github page. To install it on Windows, Mac OSx, and Raspbian. After i got these install the powershell scripts would just run on windows. But on OSx or Linux you need to add pwsh before calling the script. But that can be easier. First you need to put a symbolic link to pwsh in a common place on your Unix based systems. I chose /usr/local/bin/pwsh because on OSx I was unable to place it at /bin/pwsh. Now edit your powershell script and add #!/usr/local/bin/pwsh as the very first line in your script. We have to make it so the script is executable run chmod +x <script>.ps1 . You can now execute your script by calling it like