Powershell provides Windows administrators and software developers with a way to automate services, create scripts and send commands to a database server. You can output results of your Powershell commands to a text file. This lets you have a log of results that you can later review to analyze any performance issues on a computer. It's also beneficial if you have a large amount of results, so you can review it later in the day.
Click the Windows "Start" button and select "All Programs." Click "Accessories" and click the "Windows Powershell" directory. Click the "Powershell" icon to open the utility.
Set a variable that contains a file name for the output. You must specify a directory path and file name for the output file. Type the following code to create a file variable:
This variable sets the output file to "text.txt" that's placed in the root directory.
Type the command you want to use to create the results and use the output file variable. For instance, if you want to create a list of services running on the computer type the following code in Powershell:
Get-Service | Out-File $File -append
Click the Windows "Start" button after the Powershell command completes execution. Click "Computer" and double-click through the directories until you reach the one that contains the output text file. Double-click the file to open it and review the results of the Powershell command.
How to Write a Basic Powershell Script
PowerShell is a scripting tool that allows Windows administrators to perform a much greater range of tasks than other scripting languages, such...
How to Send DOS Output to Text
The DOS Command Prompt is a window that allows you to interact with your operating system with text. It's used to execute...
How to Work With Strings in PowerShell
The Windows PowerShell is a command line scripting language built into the Microsoft .NET Framework. It gives the system administrators a tool...
How to Use PowerShell to Append to a .Txt File
PowerShell lets you execute commands and write Visual Basic scripts on any Windows computer. The PowerShell command line is mainly used by...
How to Send an Email With Powershell
PowerShell is a powerful shell and script language for later versions of the Windows operating system. PowerShell can be used for different...
How to Delete Lines From Text File in PowerShell
PowerShell is a scripting language from Microsoft for use with the Windows operating system. The language can be used to generate many...