Suppose every morning you check today's date, greet yourself, and check how much free space is left on your drive. Typing the same three commands every day works, but writing them down once on a recipe card is much faster.

In Windows, a PowerShell script is simply a plain text file ending in .ps1 that stores PowerShell commands so you can run them all together in one go.

Step 1: Create a Simple .ps1 File

Open Notepad (or any text editor), paste these three gentle lines, and save the file as morning.ps1 in your Documents folder:

# 1. Print a friendly greeting
Write-Host "Good morning! Here is your quick PC check:"

# 2. Show today's date and time
Get-Date

# 3. Show free space on your C: drive
Get-PSDrive C

Step 2: Allow Your Own Scripts to Run

For safety, Windows blocks scripts by default so random files cannot run automatically. Run this one-time command in PowerShell to allow scripts you created on your own PC:

# Allow local scripts for your Windows user account only
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

When PowerShell asks to confirm, type Y and press Enter.

Step 3: Run Your Script

Navigate to your Documents folder and run the file by putting .\ in front of its name (this tells PowerShell the file is right here in the current folder):

# Move to Documents and run the script
cd ~\Documents
.\morning.ps1

3 Things to Remember

  • Scripts end in .ps1: Any list of PowerShell commands saved in a .ps1 text file becomes a reusable script.
  • RemoteSigned keeps you safe: It lets your own local scripts run while still checking downloaded scripts for safety.
  • Start with .\ when running: PowerShell requires .\scriptname.ps1 so you never accidentally run the wrong file.