Original Research on Combining The Power of Windows and Linux

Original Research on Combining The Power of Windows and Linux

Introduction

Combine the power of Bash on Linux and PowerShell on Windows to create tools that are greater than the sum of their parts.

Windows || Linux

For a long time, in the IT world, Linux and Windows admins often practiced a form of social distancing. You were either in the Windows camp, or the Linux camp. Linux providers such as SUSE, Canonical, and others along with Microsoft have decided to tear down this wall that separates these two technologies. You can too! This article demonstrates a very practical way to leverage the strengths of both Windows and Linux. See these instructions for installing WSL.

Linux && Windows

I have a Windows 2019 Server and from a PowerShell prompt I can type: bash and “ahhh...” I’m at home! To do this, I installed Windows Subsystem for Linux (WSL) and I then chose to install Ubuntu as my Linux distribution. I have also done the same installation to my Windows 10 box so that my bash terminal is always close by. See: How to run Linux on Windows Server 2019 with WSL for detailed instructions on how to do this. 

Windows + Linux

I’ve created a solution that uses a PowerShell script (port_check.ps1) plus a Bash script (port_check.sh) which need each other in order to create a server address and port check solution. The entry point to the solution is a PowerShell script. The Linux Bash script does the actual address and port check. 

You could create this solution with PowerShell alone, without Linux, but that isn’t the point of this exercise. What I am trying to demonstrate here is a methodology for leveraging the power of both Linux and Windows, . . . it’s like having both an SUV -and- a sports car in your garage.

Installing Cimitra’s Check Port Solution

[INSTALL]

In a Bash terminal on the Windows box DOWNLOAD AND RUN the install script as shown on the next line below, (NOTE: Get the entire next line)

curl -LJO https://raw.githubusercontent.com/cimitrasoftware/blog_scripts/master/port_check_install.sh -o ./ ; chmod +x ./port_check_install.sh ; ./port_check_install.sh
No alt text provided for this image

[RUN]

Now open up a Windows PowerShell terminal and run the check_port.ps1 script. 

c:\linwin\port_check.ps1 <address> <port>

Example:

c:\linwin\port_check.ps1 192.168.99.1 443
No alt text provided for this image

Just for fun, back at your Bash terminal, you can actually run the PowerShell script from Bash in the following manner: 

powershell.exe "c:\linwin\port_check.ps1" 192.168.99.1 443
No alt text provided for this image

Conclusion

For myself, this methodology means that if I prefer the way something is done in Bash, I can just port that functionality over to my PowerShell scripts.  

If you think you need to be in a Windows camp vs. a Linux camp, . . . well, you need to get up to speed. That’s the old way of doing things. There are so many more options when you combine the strengths of Linux and Windows.


 

Rob Storey

Splunk | Ex-DocuSign

4 年

Tay Kratzer it’s great how the tools for administration are crossing over. Very informative! #cimitra #cimitra

回复

要查看或添加评论,请登录

Tay Kratzer的更多文章

  • Just Keep Trying

    Just Keep Trying

    Years ago I was having a philosophical discussion with a work colleague (Willem Bagchus) regarding the changes we make…

  • Tay's Tales (From 40 Years Ago)

    Tay's Tales (From 40 Years Ago)

    LinkedIn is the one social media platform that truly makes me feel better. I love to read posts from people like Rob…

    2 条评论
  • PowerShell Hero Clinic

    PowerShell Hero Clinic

    On Labor Day weekend, my son and I fixed a leaky dishwasher. I have no expertise in dishwashers, but YouTube made us…

  • A Gift For You - Active Directory & Exchange PowerShell User Management Script with 3 Dozen Actions

    A Gift For You - Active Directory & Exchange PowerShell User Management Script with 3 Dozen Actions

    Cimitra recently created a script (available on GitHub) with a customer who has Active Directory, and On-Premise…

  • How To (Truly) Get Rid of Output

    How To (Truly) Get Rid of Output

    I was creating a script today, and I wanted to create a way for "errors" to just go away, for usability purposes, since…

    17 条评论
  • PowerShell Script to Structure Unstructured Data (SQL Data)

    PowerShell Script to Structure Unstructured Data (SQL Data)

    A Cimitra customer was retrieving data from an SQL database with PowerShell. This script below changes the loose SQL…

  • Storing PowerShell Script Variables In a Simple Text File

    Storing PowerShell Script Variables In a Simple Text File

    If you prefer not to change variables in your PowerShell script files, read on. If you prefer to pass in fewer…

  • 3 Ways To Learn a Topic Well

    3 Ways To Learn a Topic Well

    1. Learn something while attaching the knowledge you want to gain with a strong emotion attached, along with a deadline…

    1 条评论