Here are the cmdlets we will use to accomplish these tasks:
- The Get-ChildItem cmdlet to list out the contents, and Out-File across the pipeline (or the familiar redirection operator, >; they both work in PowerShell) to send the list of contents to a file.
- The Get-ChildItem cmdlet to list the contents, and the Out-File cmdlet across the pipeline to send the error to the file. Everything that is displayed on the console should go to the file this way, shouldn't it?
- The Write-Host cmdlet to display content on the screen, and, as usual, the Out-File cmdlet or the redirection operator to send the message to the file.
- Again, the Get-ChildItem cmdlet to list the contents, and the Tee-Object cmdlet with the Append switch parameter ...