Base64 PowerShell Decode & Encode – One-Liners | CheatSheet

Base64 PowerShell commands to encode and decode data in Windows

On Linux or macOS, encoding and decoding with base64 is simple. But on Windows, there’s no built-in base64 command in CMD or PowerShell. That’s why many users search for fast alternative of the base64 command in Windows. The simplest way to convert Base64 encoded/decoded data is to use PowerShell’s ToBase64String and FromBase64String methods. The one-liners below will let you work with strings and files securely – without sending your data to any third-party tools. This guide shows how to use Base64 PowerShell commands to make all Base64 data converts locally. (more…)

The Best Windows Dig Equivalent for DNS Queries

Windows Command Prompt returns the error: "'dig' is not recognized as an internal or external command, operable program or batch file"

The dig command is an essential DNS troubleshooting tool on Linux and macOS. However, attempting to use it in a Windows Command Prompt or PowerShell will return the errors as follows:

‘dig’ is not recognized as an internal or external command, operable program or batch file.

dig : The term ‘dig’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

The Windows dig equivalent are the Resolve-DnsName command in PowerShell and the nslookup command in Command Prompt.

Below is a quick guide on how to use these commands to check DNS records in Windows. (more…)

Windows: PowerShell `Tail`, & `Head` Equivalents

The tail and head are two of the most commonly used commands for displaying the contents of a file in Linux.

Windows PowerShell, in its turn, also has equivalents of the Linux tail and head commands.

From this short post you will learn how to use the equivalents of the tail and head commands in Windows PowerShell and how to dynamically print a file’s contents, i.e. follow it like using tail -f. (more…)

PowerShell: Get Command Help (–help/-h/?) [SOLVED]

The help command is a special command that is used to provide more information on another commands.

In Windows PowerShell the help command can be called at any time to learn more about a command’s usage and syntax, like the available options and how to structure the command to use these options.

However, at first, it may not be so obvious how to actually call the help command in PowerShell and this short post can help you with this. (more…)

Windows: Measure Command Execution Time in PowerShell

The time command in Linux and Unix-like operating systems is used to determine how long a specific command or script will take to run.

In Windows PowerShell there is a built-in Measure-Command, that can be considered as the Linux time command equivalent.

This short post shows how to use the Measure-Command in PowerShell to evaluate the processing time taken by different commands, scripts or programs in their execution. (more…)

Install Kubectx & Kubens on Windows

kubectx and kubens are two command-line tools that can help to manage Kubernetes clusters and namespaces more efficiently.

kubectx is used for switching between Kubernetes contexts (clusters) faster, while kubens is used for switching between Kubernetes namespaces more easily.

This post shows how to install kubectx and kubens on Windows so they can be used from PowerShell or Command Prompt (CMD). (more…)

WHOIS Command on Windows – PowerShell & CMD

In Linux, a whois command is used to lookup information about domains or IP addresses.

But if you try to run the whois command on Windows from PowerShell or command prompt (CMD), you will receive one of the errors below:

‘whois’ is not recognized as an internal or external command,
operable program or batch file.
– or –
whois : The term ‘whois’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

This post shows how to install the whois command on Windows and make it available in PowerShell and CMD. (more…)

[SOLVED] PowerShell: Running scripts is disabled on this system

While trying to run a PowerShell script you may get an error message that says “cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.

This error message is due to the default execution policy set by PowerShell, that determines whether PowerShell scripts can be run on a system.

By default, the execution policy is set to Restricted, which means that PowerShell scripts cannot be run.

To fix this error message, it is required to change the execution policy to RemoteSigned and this post shows how to do this. (more…)

Kubectl Autocomplete in PowerShell

A kubectl autocomplete is a feature that helps to complete kubectl commands or filenames automatically by pressing the ↹ Tab key.

This feature can be enabled in Windows PowerShell by invoking a simple kubectl completion powershell command.

Though this way it will be enabled temporary for the current session only.

To enable the kubectl autocomplete feature permanently it is required to add some commands to your Powershell $PROFILE file and this post shows how to do this. (more…)