Powershell
17 posts
2021
How to find your PowerShell version using $PSVersionTable. Includes version history and Windows PowerShell vs Core.
How to replace text in a string in PowerShell using .Replace(), the -replace operator, and regex patterns.
How to check if PowerShell is installed on a Windows machine before running scripts from C#.
How to import and export CSV files in PowerShell using Import-CSV and Export-CSV commands.
How to read and import text file content into PowerShell using Get-Content.
How to get the current script path in PowerShell using $PSScriptRoot and $MyInvocation.
How to write single-line and multi-line comments in PowerShell using # and <# #> syntax.
How to retry stopping and restarting a Windows service in PowerShell when it fails to stop in time.
How to pass multiple parameters into a PowerShell function correctly, avoiding common syntax mistakes.
How to create objects in PowerShell using New-Object and PSCustomObject, with practical examples.
How to use Get-Process and Stop-Process in PowerShell to find and kill running processes.
How to add your IP address to an Azure Network Security Group using PowerShell.
How to get your public IP address using PowerShell with a single command.
How to loop through an array and pass each element into a function in PowerShell using ForEach.
How to use Get-ExecutionPolicy and Set-ExecutionPolicy in PowerShell to manage script permissions.
How to use Get-Help in PowerShell to find documentation for any command directly from the terminal.
How to fix 'ps1 cannot be loaded because running scripts is disabled on this system' in PowerShell on Windows.