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
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
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…
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…
Here is a quick one-liner that identifies the full path to your current PowerShell host:
PS> (Get-Process -Id $pid).Path
The path tells you where your current host is located, and you can check whether your code is being executed in Windows PowerShell, PowerShell…
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…
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…
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…
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…
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.
Powered by IDERA