PowerShell is an excellent programming language that allows you to interact with various Windows components. With PowerShell scripts, you can modify and work with the Registry, file system, group policies, system settings, and more. If you are someone who wants to automate tasks on your Windows PC, PowerShell is the best place to start your journey. So, in this guide, we give you a basic introduction on how to create and run a PowerShell script in Windows 10 and 11.
Create a PowerShell script with Notepad
- Open Pad from the Start menu.
- Now we are going to use a simple
Start-Processcommand to open “beebom.com” in Chrome.
Start-Process chrome.exe "beebom.com"

- To create a PowerShell script, click “File” and choose “Save as“.

- Name the file and make sure add “
.ps1“ at the end to turn it into an executable PowerShell script. I have named itscript.ps1and saved the file to the desktop.

- To run the PowerShell script, right-click the
script.ps1file and choose “Run with PowerShell“.

- That’s all. A Chrome window (or whatever your default browser is) will open and the website will launch. This is a basic example how to create a PowerShell script and run it.

Run a PowerShell script from PowerShell or CMD
- You can also run the script from a PowerShell terminal. Open PowerShell o Terminal from the Start menu. You do not need administrator privileges to run a script.
- Now, run the following command to allow PowerShell to execute scripts. This will allow PowerShell run local scripts. If the first command shows an error, run the second command.
Set-ExecutionPolicy RemoteSigned
either,
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

- Next, move to location where you have saved the script using the CD domain.
cd Desktop
- After that, run the command as follows. Begin with “
.\“ and add the file name (without space) along with the.ps1extension. Now, press Enter.
.\script.ps1

- This will execute the PowerShell script from the Terminal window. In this case, a browser window will open and the website will start.
- You can also turn on a Symbol of the system window to run a PowerShell script. Run the command as follows.
cd Desktop
powershell .\script.ps1

Create and run scripts with PowerShell ISE
Windows 10 and 11 come with PowerShell ISE (Integrated Scripting Environment) that allows you to write PowerShell code and run it in an integrated environment seamlessly. It works like any other IDE and supports code indentation and many other modern features. This is how you can use it.
- Open the Start menu and search for “PowerShell ISE“. Now, open it.

- Then in the top panel you can write the code and it will run in the bottom panel.

- To demonstrate a basic example, I have written the following code that generates “Hello, world!” in the PowerShell terminal.
Write-Host "Hello, World!"
- To run the code, simply click the “Run” button in the top toolbar. You can see the result in the Terminal below.

- Here’s another basic example. Run it and this show current date and time.
$dateandtime = Get-Date -Format "dd-MM-yyyy HH:mm:ss"
Write-Host "The current date and time is: $dateandtime"

- For more information on PowerShell scripts, you can go to Excellent documentation from Microsoft. here.
So, this is how you can create and run a PowerShell script in Windows 11 and 10. PowerShell is a great scripting language for Microsoft to interact with the operating system and do things from the command line. We have already written a useful tutorial on how to automate tasks in Windows 10 to save time using Task Scheduler and PowerShell commands. Make sure to check it out.
Aside from that, if you are a Terminal addict, learn how to customize Windows Terminal to give it a new look. Anyway, that’s all from us. If you still have any questions, let us know in the comments section below.