Site icon Bernard Aybout's Blog – MiltonMarketing.com

Basic PowerShell commands that every Windows 10 user should know

Basic PowerShell commands for Windows 10

Basic PowerShell commands for Windows 10

Table of Contents

Toggle
  19 Minutes Read

🔧 Basic PowerShell Commands Every Windows 10 User Should Know

PowerShell is a command-line shell and scripting language built into Windows. It’s especially useful when the graphical interface isn’t responsive or when you need to automate repetitive tasks.

Before using PowerShell scripts, it’s wise to create a System Restore Point in case something goes wrong.


⚙️ 1. Launch a UWP App (Universal Windows Platform)

Modern Windows apps—like Settings, Calculator, Mail, or Photos—can be launched directly from PowerShell using URI (Uniform Resource Identifier) commands. This makes it fast and efficient to open specific parts of Windows without navigating menus or clicking through settings.

The command format is:

Start-Process "URI"

✅ Example:

Start-Process "ms-settings:"

This opens the main Windows Settings window, just as if you’d clicked it from the Start menu.


🧭 Launch Specific Settings Pages

You can also launch specific sections within Settings using more targeted URIs. Here are some examples:

Task Command
Open Network & Internet settings Start-Process "ms-settings:network"
Open Display settings Start-Process "ms-settings:display"
Open Windows Update Start-Process "ms-settings:windowsupdate"
Open Privacy settings Start-Process "ms-settings:privacy"
Open Apps & Features Start-Process "ms-settings:appsfeatures"

This is particularly useful for scripting automation, troubleshooting, or building lightweight support tools.


📦 Launch Other Built-In UWP Apps

UWP URIs aren’t limited to system settings. You can also launch built-in apps like:

Start-Process "calculator:"
Start-Process "ms-paint:"
Start-Process "ms-edge:"
Start-Process "mail:"

Each of these opens the corresponding app instantly from PowerShell.


🔍 Find More UWP URIs

Microsoft provides a comprehensive list of UWP URI schemes that can be used for launching different parts of Windows. Bookmark it as a reference if you’re doing frequent automation or creating scripts for end-user support.


🛠 Pro Tip

Combine this with a desktop shortcut or scheduled task to build quick-launch tools or automate workflows for non-technical users.


📖 2. Get Help for Any PowerShell Command

One of PowerShell’s most underrated superpowers is its built-in documentation system. You don’t need to memorize every command—instead, you can learn as you go using the Get-Help cmdlet.

The Get-Help command is your built-in manual for PowerShell. It shows you what a command does, what parameters it accepts, and how to use it correctly—all without leaving your terminal.


🛠 Basic Usage

Get-Help

This shows general usage instructions for Get-Help itself, including how to look up help for other commands.


🔍 Learn What a Specific Cmdlet Does

Get-Help Get-Process

This gives you a summary of what Get-Process does, including a short description, syntax, and parameter list.


📚 View the Full Help Documentation

Get-Help Get-Process -Full

This expands the help output to include detailed descriptions, parameter explanations, input/output types, and notes. It’s the equivalent of reading the manual page (man page) for a Linux command.


💡 See Practical Usage Examples

Get-Help Get-Process -Examples

This shows real, practical examples of how to use the command in everyday scenarios. It’s a great place to learn by doing.


🧠 Explore Everything Available

Get-Help *

This returns a list of all help topics and available commands currently installed. It’s a great way to discover new tools and explore what PowerShell can do.


🔄 Keep Help Files Up to Date

By default, PowerShell doesn’t include the complete help files. To download the latest, use:

Update-Help

This ensures Get-Help pulls in the most current and complete documentation for all installed modules and commands.


📌 Pro Tip

If you’re ever unsure:

  • What a command does

  • What parameters it needs

  • What results it returns

Just run Get-Help <command> -Examples to see real-world usage in seconds.


PowerShell’s help system makes it nearly self-teaching. With Get-Help, the terminal isn’t a black box—it’s a step-by-step guide.


🔍 3. Discover Commands with Get-Command

When you’re new to PowerShell—or even when you’re experienced—it’s easy to forget the exact name of a command. That’s where Get-Command comes in. Think of it as PowerShell’s built-in search engine for finding available commands, functions, scripts, aliases, and executables.

The general format:

Get-Command <search criteria>

You can use it to explore, search, and filter available tools on your system.


🧠 Find Commands by Name

Get-Command -Name *service*

This searches for any command that includes the word “service” in its name. The asterisks (*) are wildcards that tell PowerShell to match anything before or after the word.

📌 Example Output Might Include:

  • Get-Service

  • Start-Service

  • Stop-Service

  • Restart-Service

This is perfect when you remember part of a command but not the full name.


🎯 Filter by Command Type

Get-Command -CommandType Cmdlet

This filters results to show only cmdlets, which are PowerShell-native commands (not external programs or scripts). Cmdlets follow the standard Verb-Noun naming pattern, like Get-Item, Remove-Item, or Start-Process.

You can also filter by other types:

  • Function

  • Alias

  • Script

  • Application

📌 Example:

Get-Command -CommandType Application

Shows you all executable programs (.exe) available in your system PATH.


⚒️ Combine Filters for Precision

Get-Command -Name *item* -CommandType Cmdlet

This returns only PowerShell cmdlets with “item” in the name, such as:

  • Get-Item

  • Copy-Item

  • Remove-Item

  • Rename-Item


🧰 Discover Aliases

PowerShell supports aliases—shortcuts for longer commands.

Get-Command -CommandType Alias

This helps you learn, for example:

  • ls = Get-ChildItem

  • gc = Get-Content

  • rm = Remove-Item


🚀 Pro Tip

Want to quickly figure out what command is running behind an alias?

Get-Command ls

This will show you that ls is actually an alias for Get-ChildItem.


With Get-Command, you’re never stuck guessing. It turns PowerShell from a mystery into a searchable, self-documenting toolkit.


📂 4. Find a Specific File or Folder with Get-Item

Need to inspect a specific file or directory? Use Get-Item—a straightforward PowerShell cmdlet that retrieves detailed information about a single item, whether it’s a file, folder, symbolic link, registry key, or even a certificate.


🔧 Basic Syntax

Get-Item "<path>"

This returns a PowerShell object representing the item at the specified location, with rich metadata like file size, attributes, timestamps, and more.


🧪 Example: Inspect a System Folder

Get-Item "C:WindowsSystem32"

This displays:

  • Mode (e.g., d----- for directories)

  • LastWriteTime

  • Length (if it’s a file)

  • Name

📌 Example Output:

Directory: C:Windows

Mode LastWriteTime Length Name
—- ————- —— —-
d—– 5/15/2024 6:40 AM System32


📄 Example: Inspect a File

Get-Item "C:WindowsSystem32notepad.exe"

This provides data like:

  • File size

  • Creation and last modified date

  • File name and full path

  • Read-only or hidden attributes


🌐 Environment Variables for Flexibility

You can use environment variables to make scripts more portable:

Get-Item "$env:SystemRootSystem32notepad.exe"

This ensures it works regardless of whether Windows is installed on C:, D:, or another drive.


💡 Bonus: Use It with Wildcards (Cautiously)

Get-Item "C:WindowsSystem32*.exe"

This only returns the first match because Get-Item is designed for single items. If you want multiple matches, use Get-ChildItem instead:

Get-ChildItem "C:WindowsSystem32*.exe"

🧰 Use Cases

  • Check if a file exists

  • Read file/folder metadata

  • Validate a path in a script

  • Pass the object to other cmdlets (e.g., Move-Item, Copy-Item)


🚀 Pro Tip

Combine with Test-Path to check before retrieving:

if (Test-Path "C:Templog.txt") {
Get-Item "C:Templog.txt"
}

Get-Item is your go-to tool for pinpointing and inspecting a specific file or folder, making it essential for scripting, debugging, and system auditing.


📄 5. Read File Contents with Get-Content

Need to read the contents of a file—like logs, config files, or scripts—without opening a text editor? Get-Content is the PowerShell command for that. It outputs file contents line by line, directly in the terminal.


🔧 Basic Syntax

Get-Content "<path>"

It reads and displays the file content as an array of strings (each line is a separate element).


🧪 Example: View the Windows Hosts File

Get-Content "$env:SystemRootSystem32driversetchosts"

This reads the contents of the hosts file, which maps hostnames to IP addresses. It’s commonly used for testing websites or blocking domains.

📌 Why use $env:SystemRoot?

Instead of hardcoding:

C:WindowsSystem32driversetchosts

You use:

$env:SystemRoot

This dynamically references the Windows directory, which makes your script portable and OS-agnostic—perfect for environments where Windows may be installed on D:, E:, or elsewhere.


🔍 Sample Output

# Copyright (c) Microsoft Corporation.
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
127.0.0.1 localhost
::1 localhost

Every line is shown exactly as it appears in the file, making it easy to verify configurations or parse specific entries.


🛠 Practical Uses

  • ✅ View configuration files (.ini, .conf, .json)

  • ✅ Read log files to troubleshoot issues

  • ✅ Pipe into Select-String to search for keywords

  • ✅ Use in scripts to extract specific values


🔗 Combine with Other Cmdlets

Want to find a specific line or keyword?

Get-Content "$env:SystemRootSystem32driversetchosts" | Select-String "localhost"

This searches the file for any line containing “localhost”—very handy when dealing with large logs.


🚀 Pro Tip: Tail a File (Live Log Monitoring)

Want to watch new lines as they’re added (like tail -f in Linux)?

Get-Content "C:PathToLogFile.log" -Wait

This will continue streaming new content as the file updates—perfect for monitoring logs in real time.


Get-Content is your go-to for reading and analyzing text-based files directly from the command line—efficient, flexible, and script-friendly.


🛠️ 6. Manage Services with PowerShell

Windows services are background processes that run independently of user interaction. Think of them as the invisible workhorses of your operating system—handling tasks like updates, printing, networking, and system security. PowerShell gives you full control to view, start, stop, pause, or restart these services with simple, scriptable commands.


📋 View All Services

Get-Service

This command lists all services installed on the system—whether they’re running, stopped, or paused.

📌 Example output:

Status Name DisplayName
------ ---- -----------
Running wuauserv Windows Update
Stopped Spooler Print Spooler
Running WinDefend Windows Defender Antivirus Service

You’ll see the status (Running or Stopped), the service name, and its friendly display name.


▶️ Start a Service

Start-Service -Name "wuauserv"

This starts the Windows Update Service, which may have been disabled or stopped due to troubleshooting or system configuration.


⏹ Stop a Service

Stop-Service -Name "wuauserv"

This stops the update service. Useful if updates are interfering with another process, or if you’re doing system maintenance.


🔁 Restart a Service

Restart-Service -Name "wuauserv"

This command is especially handy when a service is misbehaving and needs a soft reset.


🔧 Use Case: Troubleshooting Windows Update

If updates are stuck or failing, one quick troubleshooting step is:

Stop-Service -Name "wuauserv"
Start-Service -Name "wuauserv"

You can also combine this with stopping bits (Background Intelligent Transfer Service):

Stop-Service -Name "bits"
Start-Service -Name "bits"

🧰 Check a Specific Service’s Status

Get-Service -Name "Spooler"

Shows the current state of the Print Spooler service—helpful when dealing with printing issues.


🚀 Bonus: Manage Multiple Services at Once

Want to restart multiple services in one go?

"wuauserv", "bits", "cryptsvc" | ForEach-Object { Restart-Service -Name $_ }

This restarts Windows Update, BITS, and Cryptographic Services in a single line—very useful for update repair scripts.


PowerShell gives you full visibility and control over Windows services, turning time-consuming troubleshooting into quick, repeatable steps.


🧠 7. Monitor and Control Processes in PowerShell

Processes are programs actively running on your computer—whether visible like Chrome and Notepad, or background tasks like system services. PowerShell allows you to manage these processes just like Task Manager—but with precision, automation, and scripting power.


📋 View Running Processes

Get-Process

This lists all running processes, with useful details like:

  • ProcessName – Name of the process

  • Id – Unique process ID (PID)

  • CPU – Amount of CPU time used

  • WorkingSet (Memory) – RAM usage in bytes

📌 Example output:

Handles NPM(K) PM(K) WS(K) CPU(s) Id ProcessName
------- ------ ----- ----- ------ -- ------------
124 10 3000 5000 0.20 4124 notepad
1528 75 65000 72000 12.73 3132 chrome

This lets you monitor what’s running and how much system resources it’s using—just like Task Manager, but in command form.


▶️ Start a Process (Open a Program)

Start-Process "notepad"

This launches Notepad. You can use this to open:

  • Applications: Start-Process "calc"

  • URLs: Start-Process "https://example.com"

  • Files with default apps: Start-Process "C:Docsreadme.pdf"


⏹ Stop a Process (Force Close)

Stop-Process -Name "notepad"

This forcefully closes any running Notepad windows. You can also use:

Stop-Process -Id 4124

That targets the process using its Process ID (useful when multiple instances are running).

⚠️ Be careful—Stop-Process does not prompt for confirmation. Any unsaved work in the process will be lost.


🔍 Target a Specific Process

Get-Process -Name "chrome"

This filters the list to show only Chrome-related processes. Great for diagnostics or cleanup scripts.


🚀 Bonus: Kill Multiple Processes at Once

"notepad", "calc" | ForEach-Object { Stop-Process -Name $_ -ErrorAction SilentlyContinue }

This shuts down Notepad and Calculator if they’re running—useful for locking down machines or cleaning up user sessions.


🛠 Use Cases

  • Quickly close frozen apps

  • Monitor memory usage of long-running processes

  • Launch tools or URLs during automated scripts

  • Kill CPU-hogging apps during maintenance


PowerShell gives you the same visibility as Task Manager—but adds speed, repeatability, and automation. Whether you’re fixing a hang, launching tools, or writing custom workflows, Get-Process, Start-Process, and Stop-Process are essential tools in your kit.


🔐 8. Set Script Execution Policy in PowerShell

PowerShell includes built-in security mechanisms to prevent unauthorized or unsafe scripts from running on your system. This is where Execution Policies come into play. They control how and whether PowerShell runs scripts based on their origin and digital signature.

By default, PowerShell’s policy is restrictive—and for good reason. But if you’re writing or using custom scripts, you may need to loosen it slightly.


⚙️ Change the Execution Policy

Set-ExecutionPolicy RemoteSigned

This command sets the policy to allow local scripts to run while still blocking unsigned scripts from the internet or email attachments.

You’ll usually see a prompt:

Execution Policy Change
The execution policy helps protect you from scripts that you do not trust.
Do you want to change the execution policy?[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"):

🔐 Execution Policy Options Explained

Policy Name Description
Restricted (Default) No scripts allowed. Only interactive commands can run.
RemoteSigned Local scripts can run. Scripts from the internet must be digitally signed.
AllSigned Every script (local or remote) must be signed by a trusted publisher.
Unrestricted All scripts can run, including unsigned ones. You’ll still see a warning for remote files.

🧠 Example Use Case

You’ve written a PowerShell script (backup.ps1) to automate file backups, but PowerShell throws this error:

File C:Scriptsbackup.ps1 cannot be loaded because running scripts is disabled on this system.

To fix this:

Set-ExecutionPolicy RemoteSigned

Now local scripts like backup.ps1 will run without error.


🔒 Important Notes

  • Execution policy is not a security boundary—it’s a convenience feature to prevent accidental script execution.

  • You can scope the policy to specific levels:

    Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

    This applies only to the current user, not system-wide—useful if you don’t have admin rights.

  • You can bypass the policy for a single session without changing settings:

    powershell.exe -ExecutionPolicy Bypass -File script.ps1

⚠️ Use With Caution

Setting your policy to Unrestricted or Bypass can expose your system to malicious scripts, especially from email or untrusted downloads.

Stick with RemoteSigned or AllSigned for most real-world use unless you really know what you’re doing.


🔍 Check Current Execution Policy

Get-ExecutionPolicy

Or for all scopes:

Get-ExecutionPolicy -List

PowerShell’s execution policy system strikes a balance between security and flexibility—but you’re in the driver’s seat. Set it wisely depending on your workflow, and always test scripts from trusted sources.


 

📁 9. Copy Files or Folders with Copy-Item

When you need to duplicate files or entire directories, Copy-Item is your go-to command in PowerShell. It functions like drag-and-drop or copy-paste—but in a way that’s fast, scriptable, and automatable.


📄 Copy a Single File

Copy-Item "C:sourcefile.txt" -Destination "D:backup"

This copies file.txt from the C:source folder to D:backup. If the destination folder doesn’t exist, PowerShell will throw an error unless you create it first.

You can also rename the file as it’s copied:

Copy-Item "C:sourcefile.txt" -Destination "D:backupfile-copy.txt"


📁 Copy an Entire Folder

Copy-Item "C:sourceFolder" -Destination "D:backup" -Recurse

  • The -Recurse flag tells PowerShell to include all subfolders and files inside sourceFolder.

  • Without -Recurse, it would only copy the top-level folder without any contents.


🚫 Overwriting Existing Files

PowerShell doesn’t overwrite files by default if they already exist at the destination. You can handle this with:

Copy-Item -Path "C:sourcefile.txt" -Destination "D:backup" -Force

Use -Force to overwrite files or copy into hidden/system directories.


🔍 Wildcard Support

Copy multiple files using wildcards:

Copy-Item "C:source*.txt" -Destination "D:backup"

This copies all .txt files from the source folder.


🚀 Use Cases

  • Backing up critical data before updates

  • Copying logs for diagnostics

  • Transferring content between directories in scripts

  • Duplicating project templates for new tasks


🧠 Pro Tip: Automate Folder Creation

Ensure the destination folder exists using New-Item:

if (-Not (Test-Path "D:backup")) {
New-Item -Path "D:backup" -ItemType Directory
}
Copy-Item "C:sourcefile.txt" -Destination "D:backup"


🛡️ Safe Practice

Always test with a dry run first. Add -WhatIf to simulate the operation:

Copy-Item "C:sourcefile.txt" -Destination "D:backup" -WhatIf

This lets you preview what would happen—without actually copying anything.


Copy-Item gives you full control over how files and folders move through your system—perfect for backups, scripts, and large-scale file operations.


❌ 10. Delete Files or Folders with Remove-Item

Need to clean up temp files, delete outdated logs, or remove unwanted folders? PowerShell’s Remove-Item command gives you powerful control to delete files and directories—but with that power comes risk. Used carefully, it’s an essential tool for system maintenance and automation.


🗑️ Delete a File

Remove-Item "C:tempfile.txt"

This removes the specified file immediately—no confirmation prompt, no Recycle Bin. Once it’s gone, it’s gone.


📁 Delete a Folder

Remove-Item "C:tempfolder" -Recurse
  • The -Recurse flag is required to delete a folder and all its contents (files and subfolders).

  • Without -Recurse, PowerShell won’t delete directories that aren’t empty.


⚠️ Preview Deletions Safely

Before running any real deletion command, always test with -WhatIf:

Remove-Item "C:tempfolder" -Recurse -WhatIf

This simulates the action and shows you what would be deleted—without actually doing it.

📌 Example output:

What if: Performing the operation "Remove Directory" on target "C:tempfolder".

This is your safety net, especially when scripting destructive actions.


🧠 Delete Multiple Files

You can use wildcards to delete batches of files:

Remove-Item "C:logs*.log"

Or filter specific ones:

Remove-Item "C:logslog*.txt" -WhatIf

This will preview deletion of all .txt files starting with “log”.


🔐 Delete Hidden or Read-Only Files

To remove protected or read-only files, use -Force:

Remove-Item "C:Systemhiddenfile.txt" -Force

Only use this when absolutely sure—you’re bypassing file protections.


🛡 Best Practices for Safe Deletion

Tip Why It Matters
Use -WhatIf Prevents accidental data loss
Double-check paths Avoid targeting the wrong directory
Use -Recurse with caution Deletes everything under the path
Add -Force only when needed Bypasses safeguards—don’t overuse it

🚀 Automate Cleanup Tasks

You can combine Remove-Item with scheduled tasks or scripts to clear temp files daily:

$oldLogs = Get-ChildItem "C:logs" -Filter *.log | Where-Object
$oldLogs | Remove-Item -Force

This deletes .log files older than 7 days—great for keeping your system lean.


Remove-Item is one of the most powerful and dangerous tools in PowerShell. Used wisely, it streamlines cleanup and scripting. Used carelessly, it’s irreversible. Always preview, double-check, and script defensively.


  •  

    🧭 Bonus: More PowerShell Commands to Explore

    Once you’ve mastered the basics, PowerShell has plenty more powerful commands that can take your automation, troubleshooting, and scripting skills to the next level. Here are a few bonus tools that are especially useful for searching, checking paths, handling data, and staying up to date.


    🔎 Select-String: Search Inside Files (Like grep)

    Select-String -Path *.log -Pattern "error"

    This scans through every .log file in the current folder and highlights lines that contain the word “error”.

    📌 Use Cases:

    • Search logs for specific messages

    • Filter config files for keywords

    • Combine with Get-Content for advanced parsing

    It supports regex too:

    Select-String -Path *.txt -Pattern "fail(ed|ure)"


    📁 Test-Path: Check If a File or Folder Exists

    Test-Path "C:templog.txt"

    Returns True or False depending on whether the item exists. Perfect for conditional logic in scripts.

    📌 Example:

    if (Test-Path "C:configsettings.xml") {
    Get-Content "C:configsettings.xml"
    }

    Use it to prevent errors before accessing files, directories, registry keys, etc.


    🔄 Update-Help: Keep PowerShell Documentation Current

    Update-Help

    Downloads and installs the latest help files for PowerShell modules on your system. This improves the output of Get-Help so you always have up-to-date syntax, examples, and notes.

    🔐 You may need to run this as administrator.


    📊 Export-Csv and Import-Csv: Work with Structured Data

    Export PowerShell output to a CSV file:

    Get-Process | Export-Csv -Path "processes.csv" -NoTypeInformation

    This creates a clean .csv file of all running processes—great for audits, logging, or sharing data.

    Read from a CSV file:

    Import-Csv -Path "processes.csv"

    You can then process each row as an object, perfect for building tools and reports.

    📌 Use Cases:

    • Inventory reporting

    • Logging system states

    • Automating configurations from spreadsheets


    🚀 Bonus Tip: Combine Commands for Power Scripts

    Get-ChildItem -Recurse *.log |
    Select-String "fatal" |
    Export-Csv -Path "fatal-errors.csv" -NoTypeInformation

    This finds all .log files in subdirectories, looks for lines containing "fatal", and exports the results to a CSV.


    PowerShell’s real strength shows in how commands work together, passing objects down a pipeline. These bonus commands give you the tools to search, validate, log, and automate your workflows with precision and control.

    Let me know if you want a downloadable quick-reference PDF or a visual diagram of how these cmdlets connect.


📺 Beginner-Friendly Video

Watch this beginner tutorial on PowerShell:
📹 Windows PowerShell/Command Line for Beginners (YouTube)


🧠 Summary Table

Task Command Example
Open Settings Start-Process "ms-settings:"
Get help Get-Help Get-Process
Find commands Get-Command -Name *file*
Read file Get-Content "C:file.txt"
Copy file/folder Copy-Item "C:file.txt" -Destination "D:"
Delete file/folder Remove-Item "C:file.txt"
View running processes Get-Process
Start/Stop services Start-Service "wuauserv"
Set script policy Set-ExecutionPolicy RemoteSigned
Search text in files Select-String -Path *.log -Pattern "error"

🔚 Final Thoughts

PowerShell isn’t just for IT pros—it’s a powerful tool every Windows 10 user can learn to leverage. With just a handful of commands, you can take control of your system: launch apps, manage processes, manipulate files, automate tasks, and even override security policies (carefully, of course).

The commands we’ve covered—like Get-Help, Get-Process, Copy-Item, and Set-ExecutionPolicy—offer a strong foundation. As you grow more comfortable, you’ll realize PowerShell is less about memorizing scripts and more about thinking like a problem-solver.

Remember:
🛠 Start small.
🧠 Use Get-Help often.
⚠️ Always test before automating.

With these essentials in your toolkit, you’re no longer just a user—you’re a power user.


Related Videos:

Bernard Aybouts - Blog - MiltonMarketing.com

Related Posts:

Exit mobile version