Introduction to Automatic Grid with PowerShell:

I’ve worked on a couple of PowerShell automation frameworks, that are always-ON, which is basically a bunch of scripts continuously running on a machine to monitor, test, build or for any other possible use case. One can check the live status of these scripts by logging onto the box and resize-drag-arrange any spawned script or application properly on the screen so that they don’t overlap so that you can read them properly, which I personally found very irritating.

Similarly, when I was testing socket programmed python chat application I wrote, from multiple Telnet clients it was mess to arrange and resize, something like in the below screenshot

PyChat

but recently, when I started working on one of my bot’s  which spawns multiple PowerShell script jobs on my screen , I literally lost my patience while testing and started a parallel side project to set all PowerShell consoles (or any other application) automatically in a grid layout like in the below image.
Thanks to that NO MORE RESIZE-DRAG-ARRANGE! phew!

gd

To make it available to the community I wrapped this side project script in a module and making it public with this blog post. The project is publically hosted on a Github repository where you can assist me to make it better.

github

 


Module Installation:


# Installation on PowerShell v5 from Powershell Gallery
# [Recommended] Install to your personal PowerShell Modules folder
Install-Module Gridify -scope CurrentUser
# [Requires Elevation] Install for Everyone (computer PowerShell Modules folder)
Install-Module Gridify
# Installation PowerShell V4 and Earlier from Github repository
# To install to your personal modules folder run:
iex (new-object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/PrateekKumarSingh/Gridify/master/Install.ps1')

1


Features:

‘Gridify’ module provides a cmdlet ‘Set-GridLayout’ that can resize and arrange applications in an automatic grid layout with predefined formats using the ProcessID’s of the target applications passed as a parameter(-ProcessID) value.

Cmdlet can automatically calculate your screen resolution and set Applications in a neat grid layout in predefined/custom layout

Available predefined layout formats are –

  1. Mosaic:

    This is the default layout of the cmdlet, which sets all applications with the best fit possible in 2 rows.

     


  2. Vertical:

    Vertical Layout sets all applications vertically side by side in a single row to fit the screen resolution

     

  3. Horizontal:

    Horizontal Layout sets all applications horizontally one over another in a single column to fit the screen resolution


    and a customizable grid layout for special requirements

  4. Custom:

    A custom format can be used to set the applications in a grid-layout on the screen, by passing a custom string as a value to the parameter(-Custom).


    Automatic Grid
    To set applications is custom grid-layout utilize the ‘Custom’ parameter and pass the custom layout as comma-separated string of * (Asterisk)

    Where “*” represent an application and “,” separates a row in the grid-layout

    So, with custom format like in the below example, the grid layout would be like

    Row1 has 3 applications
    Row2 has 2 applications
    Row3 has 1 applications
    Row4 has 4 applications


Known Issues and Limitations:

Please follow the below link to the Github repository of the module for known issues and some limitations, which would be fixed/enhanced soon.

issues

Hope you’ll find the script useful and Thanks for reading.

Please do follow me on twitter for more Interesting PowerShell material and don’t forget to Showoff your Powershell Gridify module to your colleagues, Cheers! 😉

Optical Character Recognition

Subscribe to our mailing list

* indicates required