If you use Windows 11 regularly, you have probably performed the same task again and again. Maybe you clear temporary files, create folders, check system details, or manage services. Doing these manually takes time. This is where PowerShell comes in.
PowerShell is a powerful automation and scripting tool built into Windows. It allows you to create small programs called scripts that automate tasks. Once you write a script, you can run it anytime with a single command. Even if you are a beginner, creating your first script is easier than you might think.
In this guide, you will learn how to create a PowerShell script from scratch in Windows 11.
Ready to build your first script? Let’s start!
How to Make A PowerShell Script in Windows 11: Easy Steps

To make a PowerShell script in Windows 11, open a text editor like Notepad, write your PowerShell commands, save the file with a .ps1 extension, adjust the Execution Policy if required, and run the script using PowerShell. This allows you to automate tasks quickly and efficiently.
Now, let us break this down step by step so you understand not just what to do, but why you are doing it.
Step 1: Open Windows PowerShell
The first thing you need is access to Windows PowerShell. Windows 11 already includes it, so you do not need to install anything.
Press the Start button and type PowerShell in the search bar. You will see Windows PowerShell in the results. Click on it to open.
You can also right-click the Start button and choose Windows Terminal, then select PowerShell from the tab options. Either method works perfectly.
When PowerShell opens, you will see a blue or black window with a command prompt. This is where you can test commands before adding them to your script.
Before creating a script, try typing the following command and pressing Enter:
Get-Date
You should see the current date and time displayed. This confirms that PowerShell is working properly. Feels simple so far, right? Now, imagine saving this command so it runs whenever you need it.
Step 2: Understand What a PowerShell Script Is
Before writing a script, it is important to understand what it actually is.
A PowerShell script is simply a text file that contains one or more PowerShell commands. Instead of typing commands one by one each time, you store them in a file. That file usually has a .ps1 extension.
For example, if you create a file called:
myscript.ps1
That file can contain multiple commands, such as:
Get-Date
Get-Process
Get-Service
When you run the script, all commands execute automatically in order.
Think of it as a shortcut for tasks you repeat often. Instead of remembering commands every time, you let the script handle everything.
Now that you understand the concept, are you ready to write your first one?
Step 3: Open a Notepad ot Notepad++
To create a script, you need a place to write it. The simplest option is Notepad, which is built into Windows 11.
Press Start and search for Notepad, then open it.
You can also use more advanced editors like Visual Studio Code if you prefer, but for beginners, Notepad is perfectly fine.
When Notepad opens, you will see a blank page. This blank page is where you will write your PowerShell commands.
It might look too simple, but do not underestimate it. This is where automation begins.
Step 4: Write Your First PowerShell Script
Now comes the interesting part. Let us create a simple script that displays a message and shows the current date.
In Notepad, type the following:
Write-Output “Hello, this is my first PowerShell script!”
Get-Date
The first line uses Write-Output, which prints a message on the screen. The second line displays the current system date and time.
These two commands together form a simple script.
You can also add comments in your script. Comments help explain what the script does and are ignored when the script runs. To add a comment, use the # symbol.
For example:
This script displays a welcome message
Write-Output “Hello, this is my first PowerShell script!”
Get-Date
Adding comments is a good habit, especially as scripts become longer. Even small scripts can benefit from clarity.
You just created your first PowerShell script content. Excited to see it in action?
Step 5: Save the Script with .ps1 Extension
Writing the script is only half the process. Now you need to save it correctly.
Click on File in Notepad and select Save As.
Choose a location that is easy to access, such as the Desktop.
In the File name field, type:
myscript.ps1
This is very important. The .ps1 extension tells Windows that this is a PowerShell script file.
Below the file name, change Save as type to All Files. If you leave it as Text Documents, Notepad may save it as myscript.ps1.txt, which will not work.
Click Save.
You now officially have your first PowerShell script file. But will it run immediately? Let us find out.
Step 6: Check and Set Execution Policy
By default, Windows 11 may block scripts from running for security reasons. This is controlled by something called the Execution Policy.
Open Windows PowerShell again. To check the current policy, type:
Get-ExecutionPolicy
Press Enter.
If it shows Restricted, scripts will not run. Do not worry, this is normal.
To allow local scripts to run, type:
Set-ExecutionPolicy RemoteSigned
Press Enter.
You may be asked to confirm. Type Y and press Enter.
This setting allows scripts created on your computer to run, while still protecting against unsafe downloaded scripts.
This step is important. Without it, your script might fail to run. Now that permissions are set, are you ready to execute your script?
Step 7: Run the PowerShell Script
Navigate to the folder where you saved your script. If you saved it on the Desktop, type this in PowerShell:
cd Desktop
Now type:
.\myscript.ps1
Press Enter.
If everything is correct, you will see your custom message followed by the current date and time.
That is it. Your script just ran successfully.
Notice the *.* before the file name. This tells PowerShell to run the script from the current directory.
It may feel like a small action, but this is how automation begins. Imagine expanding this script to manage files, monitor processes, or generate reports. The possibilities grow quickly.
FAQs
Is PowerShell safe to use?
Yes, PowerShell is a built-in Windows tool designed for system management and automation. However, you should be careful when running scripts downloaded from unknown sources. Always review script content before executing it.
Do I need coding experience to create PowerShell scripts?
No. Basic scripts require simple commands. As you gain confidence, you can explore more advanced scripting features like variables, loops, and functions.
Why is my script not running?
The most common reason is a restrictive Execution Policy. Run Get-ExecutionPolicy to check your settings. Also, ensure the file has a .ps1 extension, and you are running it from the correct directory.
Can I schedule a PowerShell script to run automatically?
Yes. You can use Task Scheduler in Windows 11 to run scripts at specific times. This is especially useful for maintenance or automated reporting tasks.
What editor is best for PowerShell scripting?
Beginners can use Notepad. More advanced users prefer editors like Visual Studio Code because of syntax highlighting and debugging features.