On this page, I am bringing together all the important PowerShell tutorials so you can learn in a structured way while still jumping to specific topics when you need to. I have grouped the tutorials into categories: PowerShell basics, arrays and objects, strings and text, files and folders, dates and time, SharePoint & Microsoft 365 automation, error handling and functions, and real‑world patterns.
What is PowerShell, and why use it?
PowerShell is a powerful scripting language and command‑line shell from Microsoft that lets you automate tasks, manage systems, and work with data more efficiently than you can with just the GUI. I like to think of PowerShell as the “remote control” for Windows, Microsoft 365, SharePoint, and many other platforms, giving you repeatable, scriptable workflows instead of manual clicks.
IT admins, developers, and consultants use PowerShell to manage users, files, SharePoint sites, Microsoft Teams, security settings, and more at scale. If you are working in the Microsoft 365 ecosystem, learning PowerShell will save you hours on repetitive admin tasks and open the door to advanced automation.
Who is this PowerShell tutorials hub for?
This PowerShell tutorials hub is for beginners who want to learn PowerShell from scratch as well as working professionals who want ready‑to‑use script patterns for real environments. If you are new, you can follow the sections in order to build a strong foundation in PowerShell basics, arrays, strings, files, and dates.
If you already write scripts, you can use this hub as a quick reference for specific solutions in SharePoint Online, Microsoft 365, Microsoft Teams, file system automation, or advanced string and array operations. Each tutorial is written with clear examples so you can copy, adapt, and apply them in your own scripts.
How to follow this PowerShell learning path
If you are a complete beginner, start with PowerShell basics and getting started to understand core concepts, naming conventions, variables, and how to run scripts safely. Then move into Arrays and objects in PowerShell and Strings and text manipulation so you can work with data properly. After that, go through Files, folders, and logging and Dates and time operations to build real automation scripts.
Once you are comfortable, explore SharePoint and Microsoft 365 automation, then dive into Error handling, functions, and script structure and finally use Real‑world PowerShell examples as patterns you can reuse in your projects.
1. PowerShell basics and getting started
Start here if you are new to PowerShell or if you want to strengthen your fundamentals. These tutorials cover core concepts such as variables, naming conventions, operators, environment variables, and script execution.
- Understand the platform and common commands with PowerShell examples for beginners
- Follow best practice naming with PowerShell naming conventions
- Apply good variable style using PowerShell variable naming conventions
- Compare values correctly with PowerShell greater than or equal operator
- Run scripts safely using PowerShell set‑execution policy
- Work with environment variables using Set environment variables using PowerShell
- Learn the scripting environment with PowerShell ISE tutorial
- Run scripts more efficiently using Run PowerShell script in Visual Studio Code
- Check variable values safely using Check if a variable is null or empty in PowerShell
- Use conditions with data using PowerShell Where‑Object examples
2. Arrays and objects in PowerShell
Arrays and objects are at the core of PowerShell scripting. Use this section to learn how to create arrays, loop through them, filter, sort, and work with arrays of objects.
- Get started with collections using PowerShell array tutorial
- Store text lists using PowerShell array of strings
- Add new items dynamically with PowerShell add item to array
- Work with resizable collections using PowerShell ArrayList tutorial
- Loop through arrays using PowerShell loop through array
- Filter multiple items using PowerShell foreach vs ForEach‑Object
- Create arrays from CSV using PowerShell create array from CSV
- Export data cleanly with PowerShell export array to CSV
- Turn arrays into strings using Convert array to comma separated string in PowerShell
- Work with arrays of objects using Access array of objects in PowerShell
- Loop through complex objects using Loop through an array of objects in PowerShell
- Count items correctly with Count the number of objects in an array in PowerShell
- Sort results easily using Sort array of objects in PowerShell
- Split large arrays using Split an array into smaller arrays in PowerShell
- Create arrays from multiline text using Convert multiline string to array in PowerShell
- Remove duplicate entries with Remove duplicate objects from an array in PowerShell
- Drop edge items with Remove the first and last item in an array in PowerShell
- Check for specific values using Check if an array contains a string in PowerShell
- Get unique values quickly with Get unique values from an array in PowerShell
- Find max values using Get the highest number in an array in PowerShell
- Compare two sets of data with Compare array of objects in PowerShell
- Access specific positions using Access first item in an array in PowerShell
- Read the last element with PowerShell get last item in array
- Detect empty collections with Check if array is empty in PowerShell
- Format arrays as tables using Format an array of objects as table in PowerShell
3. Strings and text manipulation in PowerShell
String handling is one of the most common tasks in PowerShell scripting. This section covers concatenation, searching, replacing, splitting, and working with special characters in strings.
- Join values and display text with PowerShell concatenate string with Write‑Host
- Check prefixes using PowerShell string starts with
- Detect special characters using PowerShell string contains special characters
- Search text easily with PowerShell Select‑String examples
- Replace text in general using PowerShell Replace method
- Replace matching patterns using PowerShell replace with regular expressions
- Replace text in files using Replace a string in text file with PowerShell
- Update XML content with Replace string in XML file using PowerShell
- Modify JSON content using Replace string in JSON file using PowerShell
- Handle commas and semicolons using Replace semicolon with comma in PowerShell
- Work with backslashes using Replace strings containing backslashes in PowerShell
- Replace case‑insensitive text with PowerShell replace string case insensitive
- Handle double quotes using Replace string containing double quotes in PowerShell
- Replace characters before markers using PowerShell replace string before character
- Apply replacements inside arrays using Replace a string in an array using PowerShell
- Escape special symbols using PowerShell escape dollar sign
- Add quotes around values using Add quotes in PowerShell
- Remove unwanted newlines using Replace carriage returns in strings using PowerShell
- Split by separators using Split comma separated string to array in PowerShell
- Split long strings evenly with Split a string by length in PowerShell
- Remove empty entries using Remove empty lines from an array in PowerShell
4. Files, folders, and logging with PowerShell
Use this section to automate file system tasks: creating files and folders, copying and renaming, checking sizes, and writing log files. These are core skills for backup scripts, audits, and maintenance.
- Test file and folder paths using PowerShell Test‑Path examples
- Create folders only when required with Create folder if not exists using PowerShell
- Create dated files automatically using Create file if not exists with name as today’s date using PowerShell
- Write output to files using PowerShell write to file
- Save with proper encoding using PowerShell write to file UTF8
- Log output within loops using PowerShell write to file in loop
- Append text safely using Append text to files in PowerShell
- Write line by line using PowerShell write to file line by line
- Avoid extra blank lines with PowerShell write to file without carriage return
- Create structured logs using PowerShell create log file
- Copy files reliably with PowerShell Copy‑Item examples
- Preserve folder structure using PowerShell Copy‑Item with folder structure
- List and sort files using PowerShell Get‑ChildItem sort by date
- Count files for reporting with PowerShell count files in folder
- Check file sizes using Check file size using PowerShell
- List last modified times with PowerShell get file last modified date
- Detect recent changes using Check if file modified in last 24 hours using PowerShell
- Find old files by age using PowerShell find files older than specific date
- Delete old files by days using PowerShell delete files older than X days with extension
- Check dates with PowerShell if date is older than 30 days
- Compare dates for cleanup using Compare dates in PowerShell
- Find files by type using PowerShell find all files with extension
- Download from the internet using Download a file from URL using PowerShell
- Check for existing files and rename using Check if a file exists and rename it using PowerShell
- Bulk rename files using Rename multiple files using PowerShell
- Normalize folder names with Rename folders to uppercase or lowercase using PowerShell
- Unblock downloaded scripts using PowerShell unblock file
5. Dates and time in PowerShell
Working with dates and times is essential for logging, file cleanup, and scheduling. Use this section to format, compare, and manipulate dates in your scripts.
- Get current date values with PowerShell date examples
- Format dates flexibly using PowerShell get date format
- Convert date to string using PowerShell get date to string
- Remove time portions using Get date without time in PowerShell
- Work with milliseconds using PowerShell get date format milliseconds
- Subtract one day using PowerShell get date minus 1 day
- Add days to dates using PowerShell get date add days
- Compare date values with Compare dates in PowerShell
- Convert strings to date values using Convert string to DateTime in PowerShell
6. SharePoint and Microsoft 365 automation with PowerShell
This section focuses on using PowerShell and PnP PowerShell with SharePoint Online, Microsoft 365, and Microsoft Teams. Use these tutorials to manage lists, libraries, permissions, groups, sensitivity labels, and more.
- Connect to your tenant using PowerShell SharePoint Online tutorial
- Install the correct modules using Install PnP PowerShell
- Add columns from Excel using Add SharePoint list fields from Excel using PowerShell
- Bulk import list data using Read Excel file and add bulk data to SharePoint list using PnP PowerShell
- Create lists and columns using Create SharePoint list and add columns using PnP PowerShell
- Customize fields programmatically with Customize SharePoint list fields with PnP PowerShell
- Perform list CRUD using SharePoint list items CRUD operations using PnP PowerShell
- Clean up lists at scale with Remove all items from a SharePoint Online list using PnP PowerShell
- Create and delete libraries using Create and delete SharePoint document library using PowerShell
- Check storage usage using Get SharePoint document library size using PowerShell
- Download documents in bulk with Download all files from SharePoint using PowerShell
- Inspect library details using Get SharePoint list column details using PnP PowerShell
- Manage versioning using SharePoint Online PowerShell disable versioning
- Check permissions with Get SharePoint folder permissions using PowerShell
- Hide legacy UI links using Hide “Return to classic SharePoint” link using PowerShell
- Enable labels on SharePoint and groups using Enable sensitivity labels for SharePoint and M365 groups using PowerShell
- Label PDFs correctly using Enable sensitivity labels for PDF files using PowerShell
- Get group membership using Get Microsoft 365 group members using PowerShell
- Connect to Teams from scripts using Connect to Microsoft Teams PowerShell
- Troubleshoot CSOM issues with Exception calling ExecuteQuery with 0 arguments PowerShell SharePoint
7. Error handling, functions, and script structure
Use this section to make your scripts more robust and modular. Learn how to use try/catch, functions, parameters, return values, and global or reference variables.
- Handle exceptions gracefully with PowerShell try/catch examples
- Identify current function context using Get current function name in PowerShell
- Write reusable code using PowerShell functions tutorial
- Pass values into scripts using PowerShell function with parameters
- Work with array parameters using PowerShell function array parameters
- Return data from functions using PowerShell function return values
- Use functions inside conditions with Call function in if statement in PowerShell
- Pass by reference using PowerShell reference variable
- Use global scope carefully with PowerShell global variable explained
- Exit functions safely using Exit a function without stopping the script in PowerShell
- Add documentation properly with Add comments in PowerShell
- Fix syntax issues using Missing argument in parameter list PowerShell – fix
8. Conversions, parsing, and special operations
This section covers type conversions, secure strings, special parsing, and other utility operations you often need in real scripts.
- Convert text to numbers using Convert string to integer in PowerShell
- Convert passwords securely using Convert string to SecureString in PowerShell
- Access registry or file properties using PowerShell Get‑ItemProperty examples
How to use this PowerShell tutorials hub
You can use this PowerShell hub as a full learning path or as a reference while building scripts. If you are new, move from basics to arrays, then strings, then files and dates, and finally into SharePoint/Microsoft 365 automation and functions.
If you are already experienced, jump directly into the category that matches your current task: SharePoint automation, complex array work, string handling, or error handling.
As Microsoft and the PowerShell ecosystem evolve, this hub will keep getting updated with new tutorials and patterns so you always have a practical place to start or refine your scripts.
Explore other tutorial hubs
If you are working in the Microsoft 365 and Power Platform world, PowerShell is just one of your tools. You can combine PowerShell automation with SharePoint, SPFx, Power Apps, Power Automate, Power BI, Microsoft Teams, Copilot Studio, and TypeScript skills to build complete solutions.
- Build modern client‑side solutions with all SharePoint Framework (SPFx) tutorials
- Learn SharePoint development and customization with all SharePoint tutorials
- Design low‑code apps with all Power Apps tutorials
- Automate workflows with all Power Automate tutorials
- Build reports and dashboards using all Power BI tutorials
- Improve collaboration with all Microsoft Teams tutorials
- Build AI copilots and bots with all Microsoft Copilot Studio tutorials
- Build secure, data‑driven business websites using all Power Pages tutorials.
- Strengthen your scripting and web dev foundation with all TypeScript tutorials
Join the premium SPGuides Academy
If you want to go beyond individual PowerShell snippets and learn how to build complete automation solutions, you can join my premium SPGuides Academy. Inside the academy, you will find full training courses, real‑time projects, and digital products that combine PowerShell with SharePoint, Microsoft 365, Microsoft Teams, Power Apps, Power Automate, and more.
As a member, you can follow structured paths, download ready‑to‑use scripts, and see how I design automation for real clients—from requirements to implementation and deployment. This is ideal if you want to accelerate your career as a Microsoft 365 consultant or admin and build a strong automation toolkit.
Final thoughts
This PowerShell tutorials hub is designed to support you from your very first script to advanced SharePoint and Microsoft 365 automation. You can bookmark this page and come back whenever you need a specific pattern—for arrays, strings, files, dates, or PnP PowerShell—or when you’re troubleshooting a real‑world scenario.
As you keep practicing and applying these tutorials, your scripts will become cleaner, more powerful, and easier to maintain, helping you deliver more value in less time.