Skip to content

Using PowerShell-Profile with PowerShell 5.1 #164

@abt-effadj

Description

@abt-effadj

Hi. I use PowerShell 5.1 along with PowerShell 7.5.2. When I use the PowerShell-Profile against PowerShell 5.1, it has errors because some cmdlets do not support some parameters like PowerShell 7.x does.

Could you add some code logic so that the PowerShell-Profile can run under PowerShell 5.1 without errors?

Thanks!

Test-Connection : A parameter cannot be found that matches parameter name 'TimeoutSeconds'.
At C:\Users\effadj\OneDrive - Abbott\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:112 char:73
+ ... GitHub = Test-Connection github.com -Count 1 -Quiet -TimeoutSeconds 1
+                                                         ~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Test-Connection], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.TestConnectionCommand

Set-PSReadLineOption : A parameter cannot be found that matches parameter name 'PredictionSource'.
At C:\Users\effadj\OneDrive - Abbott\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:549 char:22
+ Set-PSReadLineOption @PSReadLineOptions
+                      ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Set-PSReadLineOption], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.SetPSReadLineOption

Set-PSReadLineOption : A parameter cannot be found that matches parameter name 'PredictionSource'.
At C:\Users\effadj\OneDrive - Abbott\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:578 char:23
+     Set-PSReadLineOption -PredictionSource HistoryAndPlugin
+                          ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Set-PSReadLineOption], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.SetPSReadLineOption

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions