Skip to main content
Troubleshooting

How to Run PowerShell Diagnostic Scripts Safely as Administrator

A step-by-step security guide on checking execution policies, unblocking downloaded scripts, and inspecting code before running.

Published: Nov 11, 2026 • By: Admin User

Introduction

PowerShell is one of the most powerful administrative tools on modern Windows systems. However, executing scripts downloaded from the internet requires proper security precautions.

Step 1: Inspect Script Contents

Always open the .ps1 script in Visual Studio Code, Notepad, or PowerShell ISE before running it. Look out for unexpected network requests or obfuscated commands.

Get-Content .\cleanup-toolkit.ps1 -TotalCount 20

Step 2: Unblock Downloaded Files

Windows automatically marks files downloaded from web browsers with an alternate data stream (Zone.Identifier). To unblock:

Unblock-File -Path .\cleanup-toolkit.ps1

Step 3: Check Execution Policy

If you receive an execution policy error, you can bypass it for your single session without weakening system-wide security:

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

Conclusion

By following these simple steps, you can safely leverage administrative automation scripts while maintaining full control over your environment.