Using the Out-File Cmdlet in Microsoft Windows PowerShell allows you to send the output of a command directly to a text file. For instance, the example below you will send the output of the netstat -a command directly to the desktop of the user.
NOTE: Substitute the the actual username where %username% is located.
Enjoy!