PowerShell: Fixing terminal input issues

When you start PowerShell and you are not able to enter any commands (copy/paste might still work), chances are your PSReadLine module is outdated. Fix: Update PSReadLine module Get-Module PSReadLine Version 2.0.0 # Open cmd.exe as admin and run: powershell -noprofile -command "Install-Module PSReadLine -Force" Get-Module PSReadLine Version 2.2.6

July 31, 2023

Windows: Testing network connections

Verifying that one system can connect to another system via network is a common task for managing applications. A business application that is not interconnected to some other entity is hard to find. This is a quick way to test some basic network connections on Windows without much dependencies. All you need is PowerShell and .NET which should already be included on most Windows hosts. You create a custom TcpListener (which is an instance of a ....

July 25, 2023

Windows: Publishing a remote terminal app

When working with centrally hosted applications on Windows, I often provide such programs as RemoteApp for a good user experience. A remote app runs remotely on a terminal server, but the look and feel for a user is more like a locally installed app on a client computer - e.g. the app has its own resizable window and its own taskbar entry. Publishing a remote app For publishing remote apps, I use a variation of the following command....

July 19, 2023

Unix-like `watch` and `tail` commands for PowerShell

There is no equivalent to the Unix watch command on Windows, but you can get close enough behavior. Watching commands with PowerShell # Similar to `watch <command>` PS> while ($true) {<your command>; sleep -Seconds 2} PS> while ($true) {(Get-Service -Name 'Remote Desktop Services').Status; sleep -Seconds 2} Running Running You can also follow log file output similar to the Unix tail command. Tailing logs with PowerShell: # Similar to `tail --follow <filename>` PS> Get-Content -Path <logfile> -Tail 10 –Wait PS> Get-Content -Path 'C:\app....

April 13, 2022

LVM: Extending a logical volume

Adding additional space to a LVM logical volume. $ sudo lvextend --resizefs --size <size> <group>/<volume> $ sudo lvextend --resizefs --size +2G centos/root Adding 100% of the available free space. $ sudo lvextend --resizefs --extents +100%FREE centos/root

December 5, 2021

Active Directory: Managed service accounts

Traditionally, system administrators use Active Directory (AD) basic user accounts with limited permissions to run a service (Service Account). Managed Service Accounts (MSA) are special accounts to eliminate the need for administrators to manually manage the credentials, passwords, and SPNs of traditional service accounts. Also, with MSAs these tasks no longer disrupt a service (no downtime). Pro Administration Automatic password changes. No manual password management. Availability No service downtime for password changes....

February 22, 2021

Getting the uptime from Windows

I was looking for a uptime like command for Windows. The uptime command on Linux: $ uptime 12:53:36 up 5:03, 1 user, load average: 0.83, 0.61, 0.36 $ uptime --pretty up 5 hours, 3 minutes $ uptime --since 2021-02-17 07:50:35 On Windows, there is the cmdlet Get-Uptime which is available for PowerShell version 6+. $ Get-Uptime -Since Monday, January 18, 2021 7:56:57 AM If Get-Uptime is not available, you can query the WMI with a CIM cmdlet....

February 17, 2021

Searching for files and sort them by date

Recursively search for files by name with find. Then, sort the result by time, newest first with ls -lt. $ find . -type f -name "Makefile*" -exec ls -lt {} + -rw------- 1 al al 1916 Feb 17 12:44 ./cc-python/{{cookiecutter.project_repository}}/Makefile -rw------- 1 al al 1862 Feb 17 12:41 ./data-api/Makefile -rw------- 1 al al 963 Feb 16 15:45 ./personal-website/Makefile -rw------- 1 al al 254 Feb 15 17:07 ./cc-python/Makefile

February 17, 2021