PowerShell Tutorials

This page lists every PowerShell tutorial on Collecting Wisdom.

PowerShell: How to Concatenate Strings
PowerShell: How to Replace Text in String
PowerShell: How to Replace Every Occurrence of String in File
PowerShell: How to Replace Special Characters in String
PowerShell: How to Replace Multiple Strings in File
PowerShell: How to Replace Text with Wildcard
PowerShell: How to Replace Specific Text in Multiple Files
PowerShell: How to Replace Double Quotes in String
PowerShell: How to Replace Backslash Characters
PowerShell: How to Replace Comma with Newline
PowerShell: How to Replace Only First Occurrence of Word in String
PowerShell: How to Replace Part of Filename
PowerShell: How to Replace First Character in String
PowerShell: How to Replace Entire Line that Contains Pattern
PowerShell: How to Capitalize First Letter of Each Filename
PowerShell: How to Convert Filenames to Lowercase
PowerShell: How to Use Case-Insensitive Replacement
PowerShell: How to Rename File Extension of Multiple Files
PowerShell: How to Rename a Folder
PowerShell: How to Rename Multiple Folders
PowerShell: How to Use Rename-Item and Overwrite if Filename Exists
PowerShell: How to Open a Folder
PowerShell: How to Open Notepad
PowerShell: How to Use ‘which’ Command
PowerShell: How to Use ‘cut’ Equivalent
Powershell: How to Use Equivalent of ‘touch’ Command
PowerShell: How to Use Equivalent of mkdir -p
Powershell: How to Use Equivalent of dir /b
Powershell: How to Use Equivalent of xcopy
PowerShell: How to Add Extension to Multiple Files
PowerShell: How to List All Files in Folder Without Extension
PowerShell: How to Delete All Files with Specific Extension
PowerShell: How to Delete Files with No Extension
PowerShell: How to Delete All Files Not in a List
PowerShell: How to Delete All Files Except Specific Ones
PowerShell: How to Delete File if it Exists
PowerShell: How to Delete Files Matching a Certain Pattern
PowerShell: How to Delete Files Older Than X Days
PowerShell: How to List All Files in Directory to Text File
PowerShell: How to List All Files in Directory to CSV File
PowerShell: How to List Files in Directory by Date
PowerShell: How to Keep X Number of Files and Delete the Rest
PowerShell: How to Get Most Recently Modified File in Directory
PowerShell: How to Get List of Files Modified After Certain Date
PowerShell: How to Change the Modified Date of File
PowerShell: How to Find All Files Containing a Specific String
PowerShell: How to Find Files that Do Not Contain Specific String
PowerShell: How to Find All Folders Matching a Pattern
PowerShell: How to Print Specific Line in File
PowerShell: How to Print Multiple Variables on Same Line
PowerShell: How to Print Array Elements on One Line
PowerShell: How to Show Hidden Files
PowerShell: How to Unhide a Folder
PowerShell: How to Use ‘tree’ Command to Show Files
PowerShell: How to Recursively Count Files in Subfolders
PowerShell: How to Count Folders
PowerShell: How to Find N Largest Files in a Directory
PowerShell: How to Get Folder Size and File Count
PowerShell: How to Get Folder Size in GB
PowerShell: How to Rename Column Headers in CSV File
PowerShell: How to Use Export-Csv with No Headers
PowerShell: How to Use Export-Csv with No Quotes
PowerShell: How to Use Export-Csv with Append
PowerShell: How to Use Export-Csv and Specify Column Order
PowerShell: How to Reorder Columns in CSV File
PowerShell: How to Convert Text File to CSV File
PowerShell: How to Check if File Contains Specific String
PowerShell: How to Check if String Contains any Substring from Array
PowerShell: How to Check if String Contains a Date
PowerShell: How to Check if String Contains Special Characters
PowerShell: How to Check if File is Empty
PowerShell: How to Create an Empty File
PowerShell: How to Check if File Has Been Modified in last 24 Hours
PowerShell: How to Check if String is Empty
PowerShell: How to Check if Array is Empty
PowerShell: How to Create an Empty Array
PowerShell: How to Check if Input Value Exists in Array
PowerShell: How to Create an Array of Arrays
PowerShell: How to Create an Array of Objects
PowerShell: How to Reverse the Elements of an Array
PowerShell: How to Create an Array with Initial Size
PowerShell: How to Flatten an Array
PowerShell: How to Save Folder Names in Directory to an Array
PowerShell: How to Save Each Line of Text File as Array
PowerShell: How to Add Text to Each Line in a File
PowerShell: How to Add Text to Specific Line in a File
PowerShell: How to Return Multiple Values from Function
PowerShell: How to Create Function that Returns True / False
PowerShell: How to Use If Statement with Multiple Conditions
PowerShell: A Simple Formula for “If Like”
PowerShell: A Simple Formula for “Not Contains”
PowerShell: How to Use Case-Insensitive Contains()
PowerShell: How to Check if String Ends with Specific Value
PowerShell: How to Check if String Exists in List of Strings
PowerShell: How to Check if String Starts with Specific Value
PowerShell: How to Compare Dates
PowerShell: How to Compare Two Arrays
PowerShell: How to Compare Two Files
PowerShell: How to Compare Two Strings
PowerShell: How to Compare Two Folders
PowerShell: How to Compare Two Times
PowerShell: How to Use Compare-Object and Only Show Differences
PowerShell: How to Find the Union & Intersection of Two Arrays
PowerShell: How to Create Array from CSV File
PowerShell: How to Convert XML to String
PowerShell: How to Update Content in XML File
PowerShell: How to Select XML Node by Attribute Value
PowerShell: How to Remove HTML Tags from a String
PowerShell: How to Edit a JSON File
PowerShell: How to Save JSON Object to a File
PowerShell: How to Extract Value from JSON File
PowerShell: How to Use ConvertTo-Json on Array with Single Item
PowerShell: How to Get Yesterday’s Date
PowerShell: How to Calculate Date Difference
PowerShell: How to Calculate Time Difference
PowerShell: How to Format a DateTime
PowerShell: How to Create a DateTime Object
PowerShell: How to Subtract Days from Date
PowerShell: How to Use Get-ChildItem with Filter
PowerShell: How to Use Get-ChildItem to Get Full Path of Files
PowerShell: How to Use Get-ChildItem to Return Files Only
PowerShell: How to Use Get-ChildItem with Multiple Filters
PowerShell: How to Use Get-ChildItem and Exclude Specific Items
PowerShell: How to Use Get-ChildItem and Limit Recursion Depth
PowerShell: How to Use Get-ChildItem with Specific Date Range
PowerShell: How to Use Get-ChildItem and Limit Number of Results
PowerShell: How to Check if Get-ChildItem Returns No Results
PowerShell: How to Display Get-ChildItem -Recurse Results in One Table
PowerShell: How to Combine Results of Multiple Get-ChildItem Calls
PowerShell: The Difference Between Get-Item vs. Get-ChildItem
PowerShell: How to Find Empty Folders
PowerShell: How to Remove All Empty Folders
PowerShell: How to Remove Empty Lines from a File
PowerShell: How to Remove Lines Containing Specific String
PowerShell: How to Find Duplicate Values in Array
PowerShell: How to Remove Duplicate Values from Array
PowerShell: How to Remove Items from Array that Exist in Another Array
PowerShell: How to Find Duplicate Lines in File
PowerShell: How to Find Duplicate Files
PowerShell: How to Divide an Array into Smaller Chunks
PowerShell: How to Remove ReadOnly Attribute on File
PowerShell: How to Find All Files with Specific Extension
PowerShell: How to List Unique File Types in Folder
PowerShell: How to Get String Length of Variable
PowerShell: How to Limit String Length
PowerShell: How to Return Longest String in an Array
PowerShell: How to Split String into Separate Variables
PowerShell: How to Check if a Variable is Numeric
PowerShell: How to Check if String Contains Any Letters
PowerShell: How to Retrieve a Variable from a Text File
PowerShell: How to Split File by Number of Lines
PowerShell: How to Split a String Using Multiple Delimiters
PowerShell: How to Split String Based on Tab Characters
PowerShell: How to Split String with Different Whitespaces
PowerShell: How to Split String to Get First and Last Element
PowerShell: How to Split String on First Occurrence of Pattern
PowerShell: How to Split Based on New Lines
PowerShell: How to Get First Line of String in a Variable
PowerShell: How to Get Last Day of Month
PowerShell: How to Get Date Without Time
PowerShell: How to Get Month Name
PowerShell: How to Get Day of Week
PowerShell: How to Use Echo with New Line
PowerShell: How to Insert Character into String
PowerShell: How to Repeat a Character N Times
PowerShell: How to Extract Text Between Two Strings
PowerShell: How to Extract Substring Before Specific Character
PowerShell: How to Extract Substring After Specific Character
PowerShell: How to Extract Only Numbers from String
PowerShell: How to Extract Domain from URL
PowerShell: How to Remove Everything After Last Forward Slash
PowerShell: How to Generate Random Number Between Range
PowerShell: How to Check if Number is Within a Range
PowerShell: How to Randomize Elements in an Array
PowerShell: How to Copy and Rename a File
PowerShell: How to Use Copy-Item and Create New Directory
PowerShell: How to Use Copy-Item and Exclude Folders
PowerShell: How to Use Copy-Item and Show Files Being Copied
PowerShell: How to Copy Files from Subfolders to One Folder
PowerShell: How to Copy Content of Folder to Another Folder
PowerShell: How to Get Last Item in Array
PowerShell: How to Get Last Character of String
PowerShell: How to Get Last Folder in Path
PowerShell: How to Get the Last N Lines of a File
PowerShell: How to Select Range of Lines from a File
PowerShell: How to Get First Character of String
PowerShell: How to Get First Item in Array
PowerShell: How to Get First Line of File
PowerShell: How to Get First Filename from a Folder
PowerShell: How to Get First File that Matches a Pattern
PowerShell: How to Select Second Object in Output
PowerShell: How to Use Get-Content and Skip First N Lines
PowerShell: How to Use Get-Content with Filter
PowerShell: How to Convert String to Double
PowerShell: How to Convert String to Datetime
PowerShell: How to Convert String to Directory Object
PowerShell: How to Convert Object Property to String
PowerShell: How to Create a Boolean Variable
PowerShell: How to Use GetType()
PowerShell: How to Convert Array to Comma Separated String
PowerShell: How to Convert XLSX to CSV
PowerShell: How to Add Column to CSV
PowerShell: How to Remove Column from CSV File
PowerShell: How to Remove Last Item from Array
PowerShell: How to Remove Last Line from a File
PowerShell: How to Remove Last N Characters from Filenames
PowerShell: How to Add Date to File Name
PowerShell: How to Add Prefix to All Files in Folder
PowerShell: How to Find Position of Character in String
PowerShell: How to Find Index of Specific String in Array
PowerShell: How to Get File Extension
PowerShell: How to Use Get-ChildItem to Return Folders Only
PowerShell: How to Unzip a File to Folder
PowerShell: How to Unzip All Files in Folder
PowerShell: How to Count Number of Rows in CSV File
PowerShell: How to Count Number of Lines in File
PowerShell: How to Count Number of Lines in Multiple Files
PowerShell: How to Count Specific Characters in String
PowerShell: How to Count Specific Words in a File
PowerShell: How to Count Occurrences of Each Element in Array
PowerShell: How to Subtract Time
PowerShell: How to Get Free Disk Space
PowerShell: How to Merge Multiple CSV Files into One
PowerShell: How to Convert Date to UTC Time
PowerShell: How to Check if Hash Table Contains Specific Key
PowerShell: How to Iterate Over a Hash Table
PowerShell: How to Filter a Hash Table
PowerShell: How to Update Values in Hash Table
PowerShell: How to Add Values to Hash Table
PowerShell: How to Combine Multiple Hash Tables
PowerShell: How to Remove Elements from a Hash Table
PowerShell: How to Convert Hash Table to String
PowerShell: How to Convert Hash Table to CSV
PowerShell: How to Get File Creation Date
PowerShell: How to Format CreationTime
PowerShell: How to Get Most Recently Created Folder from Path
PowerShell: How to Use Select-String to Recursively Search for Strings
PowerShell: How to Use Select-String to Search for Multiple Patterns
PowerShell: How to Use Select-String with Exact Match
PowerShell: How to Use Select-String and Output Only Matching Text
PowerShell: How to Use Select-String and Exclude Specific Pattern
PowerShell: How to Use Select-String and Only Return First Match
PowerShell: How to Get Line Number of Matches
PowerShell: How to Move All Files from Folders and Subfolders into One Folder
PowerShell: How to Move Files Older Than X Days
PowerShell: How to Use Move-Item and Overwrite Existing File
PowerShell: How to Move and Rename a File
PowerShell: How to Remove All Newlines from String
PowerShell: How to Use Import-Csv and Foreach
PowerShell: How to Use Import-Csv with No Headers
PowerShell: How to Use Import-CSV and Extract Specific Columns
PowerShell: How to Use Import-Csv Where Row Contains String
PowerShell: How to Get Values from Header of CSV
PowerShell: How to Use Group-Object with Multiple Properties
PowerShell: How to Select Top N Items from Each Group
PowerShell: How to Count Items by Group
PowerShell: How to Sort Files in Folder by Size
PowerShell: How to Sort by Specific Column
PowerShell: How to Sort a Table with Format-Table
PowerShell: How to Sort an Array of Strings by Date
PowerShell: How to Sort IP Addresses
PowerShell: How to Sort Version Strings
PowerShell: How to Sort Object Based on Custom Order
PowerShell: How to Increment a Version Number
PowerShell: How to Run a Loop X Number of Times
PowerShell: How to Loop Through Each Line of CSV File
PowerShell: How to Loop Through Folders
PowerShell: How to Use Sort-Object with Multiple Properties
PowerShell: How to Use Where-Object in List
PowerShell: How to Use Where-Object with Multiple Conditions
PowerShell: How to Use Where-Object is Not Null
PowerShell: How to Use Where-Object to Filter Dates Greater Than
PowerShell: How to Use Where-Object to Filter for Strings that End With
PowerShell: How to Use Where-Object with -notlike
PowerShell: How to Use -notlike With Multiple Values
PowerShell: How to Filter a List of Strings
PowerShell: How to Prepend Text to a File
PowerShell: How to Append to Text File
PowerShell: How to Append String to Each Item in Array
PowerShell: How to Add Item to Array Only if it Doesn’t Exist
PowerShell: How to Extract Specific Columns from Text File
PowerShell: How to Insert Line After Matching Pattern
PowerShell: How to Print N Lines After Matching Pattern
PowerShell: How to Check if Folder Exists
PowerShell: How to Use Multiple Values in Switch Statement
PowerShell: How to Use Regex in Switch Statement
PowerShell: How to Use Switch Statement with Greater Than / Less Than
PowerShell: How to Use Format-Table with No Header
PowerShell: How to Use Format-Table and Control Column Width
PowerShell: How to Format Numbers with Commas
PowerShell: How to Format Numbers to 2 Decimal Places
PowerShell: How to Prompt for Input from List
PowerShell: How to Create a Custom Input Box
PowerShell: How to Trim Trailing Spaces from String
PowerShell: How to Trim Leading Spaces from String
PowerShell: How to Trim First N Characters from String
PowerShell: How to Trim String to Specific Length
PowerShell: How to Remove Spaces from String
PowerShell: How to Remove Specific String from Text File
PowerShell: How to Remove Last Character from String
PowerShell: How to Remove First and Last Characters from String
PowerShell: How to Remove All Text Before Specific Character
PowerShell: How to Remove Leading Zeros
PowerShell: How to Remove First Line from a File
PowerShell: How to Pad Number with Leading Zeros
PowerShell: How to Escape Dollar Signs
PowerShell: How to Check if a Path is a Folder or a File
PowerShell: How to Get File Name from Path
PowerShell: How to Get Relative Path of File
PowerShell: How to Generate Random Password
PowerShell: How to Use Select-Object to Only Get Property Value
PowerShell: How to Use Select-Object and Rename Property
PowerShell: How to Use Select-Object and Skip Lines
PowerShell: How to Output Bold Text
PowerShell: How to Use Write-Host with Specific Colors
PowerShell: How to Use Write-Host and Display Tab Character
PowerShell: How to Use Write-Host to Display Multiple Lines
PowerShell: How to Reference Property that Contains a Space
PowerShell: How to List All Object Properties
PowerShell: How to Check if Object has Specific Property
PowerShell: How to Remove a Property from an Object
PowerShell: How to Use Add-Member with Multiple Values
PowerShell: How to Filter for Unique Objects
PowerShell: How to Filter Array of Objects by Property
PowerShell: How to Calculate the Average of an Array
PowerShell: How to Calculate Sum of Values in Array
PowerShell: How to Sum Values in Specific Column
PowerShell: How to Round Numbers to 2 Decimal Places
PowerShell: How to Round Numbers Up or Down
PowerShell: How to Use Exponents
PowerShell: How to Slice Arrays
PowerShell: How to Combine Two Arrays
PowerShell: How to Combine Multiple Text Files into One File
PowerShell: How to Combine Path and File Name
PowerShell: How to Convert Seconds to Hours and Minutes
PowerShell: How to Use Get-Date with Milliseconds
PowerShell: How to Use Get-Date with 24-Hour Format
PowerShell: How to Use Get-Date and Display Timezone
PowerShell: How to Compare LastWriteTime of File
PowerShell: How to Use Remove-Item and Skip Confirmation
PowerShell: How to Use Remove-Item with Multiple Files
PowerShell: How to Remove First Element from an Array
PowerShell: How to Find Minimum and Maximum Values in Array
PowerShell: How to Return Object with Max Value in Property
PowerShell: How to Convert Unix Timestamp to Datetime
PowerShell: How to Use Out-File with No Output Header
PowerShell: How to Skip Files that Cannot Be Accessed
PowerShell: How to Use Try / Catch / Finally
PowerShell: How to Use Try Catch and Print Only Error Message
PowerShell: How to Use Get-Service and Filter Results
PowerShell: How to Use Get-Service to Check Status of Service
PowerShell: How to Use Get-Service to Get Startup Type of Service
PowerShell: How to Use Regex to Capture All Matches
PowerShell: How to Split String Based on Regex Pattern
PowerShell: How to Use Regex with -notmatch
PowerShell: How to Use Get-Process to Search for Process by Name
PowerShell: How to Use New-Item and Hide Output
PowerShell: How to Create Folder if it Does Not Exist
PowerShell: How to Create Folder with Current Date as the Name
PowerShell: How to Use Test-Path with Wildcard Characters
PowerShell: How to Use Test-Path to Check Multiple Paths
PowerShell: How to Use Join-Path with More Than Two Strings
PowerShell: How to Join an Array with newline
PowerShell: How to Use Get-CimInstance with Filter