How to Find an IP Address from a MAC Address in PowerShell

PowerShell 7 console finding the IP address for a MAC address with Get-NetNeighbor

PowerShell finds an IP address from a MAC address by searching the neighbor cache, which is the ARP table for IPv4. Pass the MAC to Get-NetNeighbor: In this tutorial, I’ll show you how to find an IP from a MAC address in PowerShell with Get-NetNeighbor and arp -a, which MAC formats work, what to do … Read more

How to Check Free Memory in PowerShell (CIM and Get-Counter)

PowerShell 7 console showing free memory, total memory and percent used from Win32_OperatingSystem

Want to check free memory in PowerShell? Query the Win32_OperatingSystem class and read FreePhysicalMemory, which Windows reports in kilobytes: In this tutorial, I’ll show you how to check free memory in PowerShell with Get-CimInstance and Get-Counter, compare installed and usable RAM, see what processes use, and wrap it all in a function. My test machine … Read more

How to Get Dell Service Tag Using PowerShell (7 and 5.1)

Get Dell service tag using PowerShell with Get-CimInstance Win32_BIOS

A Dell service tag is the BIOS serial number, so the quickest way to get the Dell service tag using PowerShell is one CIM query. It works in Windows PowerShell 5.1 and PowerShell 7: In this guide, I’ll show you how to get the Dell service tag using PowerShell on your own PC, why Dell’s … Read more

How to Find the Largest Folders Using PowerShell

Find the largest folders using PowerShell

To find the largest folders using PowerShell, add up the file sizes in each folder with Measure-Object and sort the results. Windows doesn’t store folder sizes, so you have to calculate them: Below I run it on a sample folder, show the top folders in friendly units, search every subfolder level and list the largest … Read more

How to Convert JPG to PDF Using PowerShell (No Extra Software)

Convert JPG to PDF with PowerShell

To convert a JPG to PDF with PowerShell, print the image to the built-in Microsoft Print to PDF printer with PrintToFile turned on. The PDF lands at the path you give, with no Save As dialog and nothing to install: Below I build that into a reusable function, then convert one photo, combine several receipts … Read more

How to Convert HEIC to JPG Using PowerShell (No Third-Party Tools)

Convert HEIC to JPG using PowerShell

To convert HEIC to JPG using PowerShell, decode the photo with the Windows imaging decoder and save it with JpegBitmapEncoder. With the function from this page, it’s one line per photo or folder: It needs Microsoft’s free HEIF Image Extensions from the Microsoft Store. I tested it in PowerShell 7 and Windows PowerShell 5.1 on … Read more

How to Remove a Computer from a Domain Using PowerShell

Remove a computer from a domain with PowerShell

To remove a computer from a domain with PowerShell, run Remove-Computer as administrator, name the workgroup to join and restart: The credential needs rights to remove the computer account. Below I check the join state, preview the command, remove remote PCs and clean up AD. My test PC isn’t on a domain, so I used … Read more

How to Find the OU of a Computer Using PowerShell

Find the OU of a computer using PowerShell

To find the OU of a computer using PowerShell, get its DistinguishedName with Get-ADComputer and drop the first CN= part. What’s left is the OU path: Get-ADComputer needs the ActiveDirectory module from RSAT. Below I check the prerequisites, show the parsing step on sample Contoso names, and cover bulk lookups and a method that doesn’t … Read more

ConvertTo-Json in PowerShell (With Examples)

PowerShell ConvertTo-Json

ConvertTo-Json turns PowerShell objects, hashtables and arrays into JSON text. Pipe the data to it, and use [ordered] so the keys keep your order: Output in PowerShell 7: Output in Windows PowerShell 5.1: Both are valid JSON with the same data, only the spacing differs. I ran every example in PowerShell 7.6 and Windows PowerShell … Read more

How to List Drives in PowerShell (Get-PSDrive, Get-Volume, CIM)

PowerShell Get-Volume listing the C drive and a recovery volume without a drive letter

To list drives in PowerShell, run Get-PSDrive -PSProvider FileSystem. It returns every disk drive letter PowerShell can see, including mapped network drives, with used and free space. For volume details such as file system and health, use Get-Volume: Below you’ll learn how to list drives in PowerShell five ways: Get-PSDrive, Get-Volume, Win32_LogicalDisk, the .NET DriveInfo … Read more