New to PS, probably will irritate long time users

New to PS, probably will irritate long-time users, the pop-up help is really annoying…
Anyway, got this code from the Microsoft website “https://devblogs.microsoft.com/”, I’m trying to figure out how to redirect the output of a PS script to a file. I’m just copying it and changing the directory for the output file but it produces an error.
Script:
Get-Process -Name pwsh | Out-File -Path C:\PS_Power-Shell\OutPut_to_File\OutPut_to.txt

Error:
Out-File : A parameter cannot be found that matches parameter name ‘Path’.
At line:1 char:35

  • Get-Process -Name pwsh | Out-File -Path C:\PS_Power-Shell\OutPut_to_F …
  •                               ~~~~~
    
    • CategoryInfo : InvalidArgument: (:slight_smile: [Out-File], ParameterBindingException
    • FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.OutFileCommand

Could you point for any good resource for learning the PS, I’m not going to be a programmer, just need to know my way around to write some small scripts.
Any help is appreciated.
Thank you

Reading the error message and trying to understand it may help. And reading the help for the cmdlets you’re about to use would definitely help. :wink:

The parameter to provide the path for Out-File is -FilePath - not -Path. Here you can read more:

Learn Windows PowerShell In a Month of Lunches. You can also find video courses on YouTube to accompany the book’s contents if you prefer video learning.

John Savill also has a popular course on YouTube:

1 Like