psConsole

Hero image for psConsole

A PowerShell script to support a Web Interface or CLI in implementing a launch utility application.

psConsoleGrid Web Interface

Above psConsoleGrid is an example of a Launch Utility implemented as a Web application. It's content is dependent upon the psConsole PowerShell script setting the data to be displayed and it's execution.

When the Obsidian item is clicked on, the Obsidian application is launched and when clicking on VScode item, then Visual Studio Code is started.

The items defined can be Web URLs, ssh hosts, documents, multimedia or just about anything you want to launch from your desktop.


psConsole Web Interface

The psConsole interface creates the needed content which is maintained in the file, sshConfig.xml stored in the directory .ssh.

The Action buttons invoke the CRUD operations for updating the sshConfig.xml file.


psConsole script

All operations performed in the above web interfaces are accomplished by calling the psConsole.ps1 PowerShell script.

psConsole.ps1 can be ran on it's own to execute the same functionality as implemented in the web interfaces.

For example, executing the following command will launch the Obsidian application.

  PS> psConsole Obsidian

The data is maintained in an xml file, but also supports maintaining the data in a nosql LiteDB database. I found the xml method to yield the best performance.


sshConfig.xml schema

The sshConfig file can be maintained using any editor, using the psConsole web interface, or using the psConsole script.

Application entry

An application entry is defined as follows:

<Host name="Obsidian" DataCenter="DC1" Usage="Applications" Device="Linux" Org="Org1" Platform="Linux">
  <HostName>App:Obsidian.ps1</HostName>
  <User>none</User>
  <IdentityFile>none</IdentityFile>
</Host>

The Usage attribute determines category the entry will be displayed in the psConsoleGrid web interface.

The name attribute sets the value to be displayed in the psConsoleGrid web interface.

The Device attribute can be a value of All or the platform type. This record will only be displayed on Linux systems.

The HostName node value always starts with App: followed by the executable name to be launched. Be sure to setup the environmental PATH variable so it finds the executable.

ssh host entry

A ssh host entry is defined as follows:

<Host name="Ubuntu-Server" DataCenter="HOME" Usage="sshHosts" Device="terminal" Org="HOME" Platform="All">
  <HostName>192.168.1.172</HostName>
  <User>myaccount</User>
  <IdentityFile>ubuntu.key.pub</IdentityFile>
  <Web>0</Web>
</Host>

The HostName node value can be the IP address or the domain name of the server.

The User node is the account used to log into the server.

The Identityfile is the file name of the public key found in the directory .ssh

Web URL entry

A web URL entry is defined as follows:

<Host name="Convert-Sats" DataCenter="HOME" Usage="Bitcoin" Device="Web" Org="HOME" Platform="All">
  <HostName>https://waehrungsrechner.app/</HostName>
  <User>none</User>
  <IdentityFile>none</IdentityFile>
  <Web>0</Web>
</Host>

The HostName node value is the web URL value to be opened in the default browser application.

Documentation entry

A Documentation entry is defined as follows:

<Host name="ZeroTier" DataCenter="Home" Usage="Documentation" Device="MD" Org="Home" Platform="All">
  <HostName>ZeroTier.md</HostName>
  <User>none</User>
  <IdentityFile>C:\Git-KeyBase\ZeroTier\,$HOME/git-keybase/ZeroTier/</IdentityFile>
  <Web>0</Web>
</Host>

The HostName node value is the file name of the document.

The IdentityFile node value contains the full path location of the document file using the Windows OS syntax first separated by a comma followed by the Linux path syntax.

sshConfig Sample Reference

XML is always case-sensitive regardless of the platform type you are using.

<sshconfig version="1.0">
  <Host name="Obsidian" DataCenter="DC1" Usage="Applications" Device="Linux" Org="Org1" Platform="Linux">
    <HostName>App:Obsidian.ps1</HostName>
    <User>none</User>
    <IdentityFile>none</IdentityFile>
  </Host>
  <Host name="VScode" DataCenter="DC1" Usage="Applications" Device="Linux" Org="Org1" Platform="Linux">
    <HostName>App:vscode</HostName>
    <User>none</User>
    <IdentityFile>none</IdentityFile>
  </Host>
  <Host name="MacOS2" DataCenter="DC2" Usage="Applications" Device="MacOS" Org="Org1" Platform="MacOS">
    <HostName>macos2.mycompany.org</HostName>
    <User>user1</User>
    <IdentityFile>file1</IdentityFile>
  </Host>
  <Host name="windows1" DataCenter="DC1" Usage="Applications" Device="Windows" Org="Org2" Platform="Win">
    <HostName>windows1.org</HostName>
    <User>none</User>
    <IdentityFile>none</IdentityFile>
  </Host>
  <Host name="Ubuntu-Server" DataCenter="HOME" Usage="sshHosts" Device="terminal" Org="HOME" Platform="All">
    <HostName>192.168.1.172</HostName>
    <User>myaccount</User>
    <IdentityFile>ubuntu.key.pub</IdentityFile>
    <Web>0</Web>
  </Host>
  <Host name="NixOs-Server" DataCenter="HOME" Usage="sshHosts" Device="terminal" Org="HOME" Platform="All">
    <HostName>192.168.1.172</HostName>
    <User>myaccount</User>
    <IdentityFile>nixos.key.pub</IdentityFile>
    <Web>0</Web>
  </Host>
  <Host name="CryptoTicker" DataCenter="HOME" Usage="Bitcoin" Device="function" Org="HOME" Platform="All">
    <HostName>App:Show-CryptoTicker</HostName>
    <User>none</User>
    <IdentityFile>none</IdentityFile>
    <Web>0</Web>
  </Host>
  <Host name="Convert-Sats" DataCenter="HOME" Usage="Bitcoin" Device="Web" Org="HOME" Platform="All">
    <HostName>https://waehrungsrechner.app/</HostName>
    <User>none</User>
    <IdentityFile>none</IdentityFile>
    <Web>0</Web>
  </Host>
  <Host name="Memepool" DataCenter="HOME" Usage="Bitcoin" Device="Web" Org="HOME" Platform="All">
    <HostName>https://mempool.space/</HostName>
    <User>none</User>
    <IdentityFile>none</IdentityFile>
    <Web>0</Web>
  </Host>
  <Host name="RoboSats" DataCenter="HOME" Usage="Bitcoin" Device="function" Org="HOME" Platform="All">
    <HostName>App:RoboSats.ps1</HostName>
    <User>none</User>
    <IdentityFile>none</IdentityFile>
    <Web>0</Web>
  </Host>
  <Host name="ZeroTier" DataCenter="Home" Usage="Documentation" Device="MD" Org="Home" Platform="All">
    <HostName>ZeroTier.md</HostName>
    <User>none</User>
    <IdentityFile>C:\Git-KeyBase\ZeroTier\,$HOME/git-keybase/ZeroTier/</IdentityFile>
    <Web>0</Web>
  </Host>
  <Host name="PSOciBootBackup" DataCenter="Home" Usage="Documentation" Device="Web" Org="Home" Platform="All">
    <HostName>https://cadayton.onrender.com/blog/PSOciBootBackup.html</HostName>
    <User>none</User>
    <IdentityFile>none</IdentityFile>
    <Web>0</Web>
  </Host>
  <Host name="JabLess" DataCenter="Home" Usage="Music" Device="Audio" Org="Home" Platform="All">
    <HostName>https://cadayton.onrender.com/music/jabless.mp3</HostName>
    <User>none</User>
    <IdentityFile>none</IdentityFile>
    <Web>0</Web>
  </Host>
  <Host name="If You Could Read My Mind" DataCenter="Home" Usage="Music" Device="Audio" Org="Home" Platform="All">
    <HostName>https://cadayton.onrender.com/music/If You Could Read My Mind.mp3</HostName>
    <User>none</User>
    <IdentityFile>none</IdentityFile>
    <Web>0</Web>
  </Host>
  <Host name="SnowGeese" DataCenter="Home" Usage="Video" Device="Video" Org="Home" Platform="All">
    <HostName>https://cadayton.onrender.com/video/SnowGeese.mp4</HostName>
    <User>none</User>
    <IdentityFile>none</IdentityFile>
    <Web>0</Web>
  </Host>
</sshconfig>
Maintaing sshConfig with psConsole Script
PS> psConsole -cadies

Executing the above command provides options for maintaining the sshConfig file from the command line. The Sync option is not implemented.


Installation and Setup

Download psConsole.ps1 from the BarnYard Market

Web Interface Implementation

Copy the script to a common execution path on your platform and then create the sshConfig.xml in your .ssh directory.

Experimenting with nosql LiteDB

The implementation of the noSQL database LiteDB to support the sshConfig data is an experimental feature to determine the value using a noSQL database over using a XML file. At this point, I'm only seeing disadvantages in using a noSQL database rather maintaining the data in a XML file.

If you would like to come to your own conclusion, then here is a guide for implementing it.

Install LiteDB Package

PS> Install-Package -Name 'LiteDB' -MinimumVersion '5.0.9' -Source 'nuget.org' -Scope 'CurrentUser' -SkipDependenies

Install PSLiteDB module

Install-Module -Name PSLiteDB -Repository PSGallery -Scope CurrentUser

Generate LiteDB Collection

(6) Export LiteDB will export the entries in the sshConfig.xml to a LiteDB collection. The file, sshConfig.db will be found in your .ssh folder.

By default if the file, sshConfig.xml is found then the XML configuartion will be used, so rename this file and the configuration in the LiteDB will be used.



Revision History
VersionDateWhomNotes
1.0.803-02-2022cadaytonAdded 'Platform' parameter and attribute to limit displayed items to specfic platform.
1.0.701-11-2022cadaytonTweaked to work with Linux console terminal
1.0.611-15-2021cadaytonSupport for display Markdown file in browser or console
1.0.511-10-2020cadaytonSupport for launching PowerShell script or cmdlet. Support for Out-ConsoleGridView.
1.0.411-07-2020cadaytonLiteDB experimental testing.
1.0.310-20-2020cadaytonCreate Windows Terminal Profile entry(s).
1.0.210-18-2020cadaytonAdded host parameter in addition to prompting for a host.
1.0.110-12-2020cadaytonAdded CRUD, Import, Export, and Sync operations.
1.0.009-03-2020cadaytonInitial release