How to Get Dell Service Tag Using PowerShell (Complete Guide)

How to Get Dell Service Tag Using PowerShell

If you work in IT or manage Dell computers, you know how important service tags are. These unique identifiers help you track warranties, download drivers, and get support from Dell. But manually checking each machine? That’s a pain. Good news: PowerShell makes this super easy. In this tutorial, I’ll show you exactly how to grab … Read more

How to Get All Properties of an Object in PowerShell

Get All Properties of an Object in PowerShell

If you’ve been working with PowerShell for a while, you’ve probably run into situations where you need to see what properties an object has. Today, I’m going to walk you through everything you need to know about getting all properties of an object in PowerShell. We will see different methods with examples. When you run … Read more

How to Find the Most Recent File in a Directory with PowerShell

Find the most recent file in a folder with PowerShell

To find the most recent file in a directory with PowerShell, list the files with Get-ChildItem, sort them by LastWriteTime from newest to oldest, and keep the first one: Output: LastWriteTime is the date Windows shows as Date modified. I ran every example in PowerShell 7.6 and Windows PowerShell 5.1 against the same sample folder, … Read more

How to Find a Folder by Name in PowerShell

Find a folder by name in PowerShell

To find a folder by name in PowerShell, run Get-ChildItem with -Directory, -Recurse and the folder name in -Filter. The match ignores case: Output: I searched a sample Projects folder so the output stays the same. Every example ran in PowerShell 7.6 and Windows PowerShell 5.1 with the same results. Find folders by partial name … Read more

How to Kill a Process by Name in PowerShell

Kill a process by name in PowerShell

To kill a process by name in PowerShell, run Stop-Process -Name followed by the process name, without .exe. It stops every running process with that name: For the tests in this guide, I started a few hidden ping.exe processes, so nothing real was harmed. Here the command stops two of them: Output: I ran every … Read more

PowerShell Round to 2 Decimal Places (and Whole Numbers)

PowerShell round to 2 decimal places

To round a number to 2 decimal places in PowerShell, use [Math]::Round($number, 2). To display it with exactly two decimals, use the format operator, ‘{0:N2}’ -f $number, or .ToString(‘0.00′): Output: They look the same here, but they don’t return the same kind of value, and they don’t always round the same way. I ran every … Read more

How to Find a Character in a String Using PowerShell

Find a character in a string with PowerShell

To find a character in a string with PowerShell, use Contains() to check whether it’s there, or IndexOf() to get its position. IndexOf counts from 0 and returns -1 when the character isn’t found: Output: Below I cover the operator versions, case sensitivity, the second or nth occurrence, every position and counting matches. Every example … Read more

PowerShell Format-List [Tutorial With Examples]

PowerShell Format-List

Do you want to format the output from a PowerShell cmdlet? The answer is the PowerShell’s Format-List cmdlet. With Format-List, you can transform complex output into a clean, readable list that highlights every property you care about. In this tutorial, I will explain exactly how to use Format-List in PowerShell with practical, real-world examples. What … Read more

PowerShell: Find Files Modified After a Date (or in the Last 24 Hours)

PowerShell find files modified after a date

To find files modified after a date in PowerShell, pipe Get-ChildItem -File -Recurse to Where-Object and compare LastWriteTime with the date: Output: LastWriteTime is the “Date modified” column in File Explorer. I used a sample folder with fixed dates, and I ran every example in PowerShell 7.6 and Windows PowerShell 5.1, with the same results. … Read more

How to Split a String and Get the Second Element in PowerShell?

powershell split string get second element

In this tutorial, I will show how to split a string and get the second element in PowerShell using various methods with examples. Last month, I was tasked with automating data extraction from thousands of log files for a major financial services client in Chicago. The logs contained critical transaction information, but each record was … Read more