In its most basic form, a Windows PowerShell script is a collection of PowerShell commands. Here’s an example:
Get-Process notepad | Stop-Process
You can put a command into a Windows PowerShell script and run it directly as it written.
To create a Windows PowerShell script, you simply have to copy the command in a text file and save the file by using a .ps1 extension. If you create the file in the Windows PowerShell ISE and save the file, the .ps1 extension will be added automatically. If you double-click the file, it will open in Notepad by default.
To run the script, you can open the Windows PowerShell console and drag the file to the console. If you first copy the path of the ...