When it comes to making decisions and branching logic in our PowerShell scripts, we commonly use the PowerShell If statement and PowerShell Switch statement. The PowerShell If Statement The If statement is a fundamental control structure in almost every programming … Continue reading →
There a various ways we can use PowerShell to output text to a file. And we’ll discuss a few options throughout this blog. Use Set-Content and Add-Content to Output Text to a File The first approach is to use the … Continue reading →
This blog post explains how we can launch a process using PowerShell and Start-Process. In its most simplistic form, we can launch a process and essentially forget about it. In this example we’re going to launch Google Chrome. You will … Continue reading →
This post explains how to use PowerShell Copy-Item to copy a file or folder including mirror copy! Throughout this example, consider that we have created the following folder/file structure: C:\alkanesource │ file1.txt │ file2.log │ file3.zip └───alkanesubfolder │ file4.ps1 C:\alkanedestination … Continue reading →
This post explores a PowerShell Grep and FindStr equivalent using the Select-String cmdlet. Grep (Unix) and FindStr (Windows) are command line utilities used for searching text patterns within input strings and files. By using PowerShell’s Select-String cmdlet with regular expressions, … Continue reading →
This post explains how we can use the PowerShell substring method to extract and match part of a string. Before we continue, it’s important to remember that the first index of a string starts at position 0. So in the … Continue reading →
There comes a time when we want to read or write an Active Directory attribute, yet we don’t know the name of the attribute we’re looking for! This handy script will list all user and computer LDAP attributes using PowerShell … Continue reading →
In this post we provide a quick example of how we can use PowerShell to retrieve all Windows updates and patches. Get-HotFix Not Returning All Installed KBs The first thought that springs to mind is simply to run Get-Hotfix. However … Continue reading →
Here we explain how to determine and check the PowerShell version. Why Check the PowerShell Version? It’s important to know which version of PowerShell an endpoint is running since some cmdlets are only supported in specific versions of PowerShell. And … Continue reading →
This post contains an example of how we can use PowerShell to display an advanced toast notification. In this notification we will be adding a custom icon and a hero image. To do this we’ll initially use the ToastImageAndText02 XML … Continue reading →