Latest Posts
  • Power Tips: Test-Driving New SSH Remoting

    If you’d like to test-drive the new PowerShell remoting alternative that is using SSH instead of WinRM, make sure you install PowerShell 7 first.

    Next, from within PowerShell 7, install this module:

    PS> Install-Module -Name Microsoft.PowerShell.RemotingTools -Scope CurrentUser  

    Once the…

    • 23 Oct 2020
  • Power Tips: Test Whether Applications Exist

    Here is a simple one-liner that can test whether PowerShell 7 is installed on your system (or any other application):

    # name of application you want to test
    $name = 'pwsh'
    # try and find the application. Discard result and errors.
    Get-Command -Name $name -ErrorAction Ignore | Out-Null
    # if…
    • 21 Oct 2020
  • Power Tips: Converting File Paths to 8.3 (Part 2)

    In the previous post we explained how you can use an old COM component to convert default long path names to short 8.3 path names. While that’s OK for occasional conversions, using COM components is slow and resource intense.

    A “cleaner” way would be to use Windows API calls directly. Here is how…

    • 19 Oct 2020
  • Power Tips: Converting File Paths to 8.3 (Part 1)

    Many years ago, file and folder names had a maximum of 8 characters, and these short path names still exist. They can even still be useful: short path names never contain spaces and other special characters and therefore never need to be quoted or escaped. Short paths can also be helpful when paths get…

    • 15 Oct 2020
  • Power Tips: Identifying PowerShell Host and Path

    Here is a quick one-liner that identifies the full path to your current PowerShell host:

    PS> (Get-Process -Id $pid).Path 
    C:\Program Files\PowerShell\7\pwsh.exe

    The path tells you where your current host is located, and you can check whether your code is being executed in Windows PowerShell, PowerShell…

    • 13 Oct 2020
  • Power Tips: Using Online Help (Part 2)

    In the previous tip we mentioned that many PowerShell users prefer the online help over locally downloaded help. To use the online help documents by default, try this in a fresh PowerShell console:

    # by default, -? opens LOCAL help
    PS> dir -?
        Gets the items…
    • 9 Oct 2020
  • Power Tips: Using Online Help (Part 1)

    PowerShell supports both local help files and online resources. Take a look at the differences:

    # outputs help in same console window
    # level of detail depends on whether local help was
    # downloaded using Update-Help
    PS C:\> help -Name Get-Process
        Gets the processes…
    • 7 Oct 2020
  • Power Tips: Updating Help without Admin Privileges

    In Windows PowerShell, updating help used to require Administrator privileges due to a design flaw: help had to be stored in the location where the modules resided. Updating help for Microsoft modules which are stored inside the Windows folder required write access to the Windows folder. That’s why normal…

    • 5 Oct 2020
  • Power Tips: Checking Profile Scripts (Part 2)

    In the previous script we came up with a one-liner that checks which profile scripts actually exist. This solution works per host only, though, because each host uses its own host-specific profile paths.

    Here is a more generic approach: it lists all profile paths for all PowerShell hosts present on your…

    • 1 Oct 2020
  • Power Tips: Checking Profile Scripts (Part 1)

    PowerShell uses up to four profile scripts. When they exist, PowerShell silently executes any content when it launches.

    It’s important to know which profile script exist (if any) because their content can slow down PowerShell launch time, and they can be used by rouge code to sneak in.


    • 29 Sep 2020