Exploring compatibility with Windows PowerShell
When you invoke a cmdlet, PowerShell has to load the module containing the cmdlet and can then run that cmdlet. By default, PowerShell uses the paths on the environment variable $env:PSModulePath
to discover the modules and the cmdlets contained in those modules.
As this recipe shows, the set of paths held by $env:PSModulePath
has changed between Windows PowerShell 5.1 and PowerShell 7.
In this recipe, you examine the paths that PowerShell uses by default to load modules. You also look at the new commands now provided in PowerShell 7.
Getting ready
You use SRV1
for this recipe after you have loaded PowerShell 7.1 and VS Code.
How to do it...
- Ensuring PowerShell remoting is fully enabled
Enable-PSRemoting -Force -WarningAction SilentlyContinue | Out-Null
- Getting session using endpoint for Windows ...