Latest Posts
  • Power Tips: Exploring Folder Structures (Part 2)

    With just a couple of cmdlets, you can examine folder structures and i.e. return the sizes of subfolders in a folder tree.

    Here is an example that returns both total and relative folder sizes:

    # specify the folder that you want to discover
    # $home is the root folder of your user profile
    # you can use…
    • 18 Mar 2021
  • Power Tips: Exploring Folder Structures (Part 1)

    Here is a quick sample illustrating how you can discover folder structures. This example takes any root folder path and recursively traverses through its subfolders.

    For each subfolder, a new custom object is returned with the file and subfolder count and the relative subfolder path:

    # specify the folder…
    • 16 Mar 2021
  • Power Tips: Saving Text Files without BOM

    On Windows, by default many cmdlets encode text files with a BOM (Byte Order Mask) encoding. BOM writes some extra bytes at the beginning of a text file to mark the encoding used to write the file.

    Unfortunately, BOM encoding wasn’t adopted well outside the Windows world. Today, when you save a text…

    • 12 Mar 2021
  • Power Tips: Trusting Self-Signed HTTPS Certificates

    If you need to access HTTPS websites that use a self-signed test certificate or a certificate that has expired or is otherwise not trustworthy, PowerShell would refuse to connect. That’s good for most cases, but occasionally you know that the destination server is safe.

    Here is some PowerShell…

    • 10 Mar 2021
  • Power Tips: Converting Word Documents

    There are still floating around numerous Microsoft Office documents in old file formats (.doc instead of .docx).

    Here is a simple PowerShell function that takes an old .doc Word document, converts it and saves the converted document in .docx format. Provided the old Word document isn’t locked, this process…

    • 8 Mar 2021
  • Power Tips: Using Encoding Standards

    When working with text files, it is important to always use the same text encoding for reading and writing or else special characters can be damaged, or the text file may become unreadable.

    In PowerShell 7, all cmdlets as well as the redirection operator use the default UTF8 text encoding unless you…

    • 4 Mar 2021
  • Power Tips: Fixing VSCode PowerShell Issues (Part 2)

    If VSCode won’t launch a PowerShell engine when editing a PowerShell script and instead the yellow message “Starting PowerShell” in the status bar won’t go away, then one possible fix is to use a fresh and separate portable install of PowerShell 7 as the default PowerShell engine in VSCode.…

    • 2 Mar 2021
  • Power Tips: Fixing VSCode PowerShell Issues (Part 1)

    Occasionally, VSCode stalls when trying to start the PowerShell engine, or reports errors like “Language Server Startup failed”.

    If you get the latter exception, this may be related to security settings in your enterprise. To fix, run the following line in a PowerShell console (this is one…

    • 26 Feb 2021
  • Power Tips: Finding PowerShell Commands

    Get-Command can help you find PowerShell commands for a given task but this cmdlet can only search for keywords in command names and parameters.

    A more sophisticated search command can be installed from the PowerShell Gallery:

    Install-Module -Name PSCommandDiscovery -Scope CurrentUser -Verbose
    

    Find…

    • 24 Feb 2021
  • Power Tips: Repairing Install-Module (PowerShellGet)

    With Install-Module, you can easily download and install additional PowerShell modules from the PowerShell Gallery (www.powershellgallery.com). However, on Windows systems this command may be broken. Many Windows systems still ship with the outdated version 1.x, and the PowerShell Gallery has switched…

    • 22 Feb 2021