PowerShell
PowerShell blog sharing useful tips and tricks to boost efficiency, published by Peter Whyte, an experienced Microsoft SQL Server Database Administrator.
-
How to Get a Folder Size in PowerShell
Windows Explorer will tell you a folder size eventually. PowerShell tells you in one line, and can do it for every folder on the drive at once.
-
How to Format Dates with Get-Date in PowerShell
Every script that writes a log or names a file needs a date in a specific shape. These are the Get-Date format strings worth committing to memory.
-
How to Get System Information with PowerShell
One block of PowerShell answers the questions you get asked about a server: what it runs, how much memory it has, how long it has been up, and how full the disks are.
-
How to Copy Files and Folders with PowerShell
Copy-Item handles most copying jobs in one line. For very large trees, or anything that needs to resume, robocopy is still the better tool and PowerShell drives it happily.
-
How to Zip and Unzip Files with PowerShell
PowerShell has zipped and unzipped natively since version 5. Two cmdlets cover almost everything: Compress-Archive and Expand-Archive.
-
Sudo for Windows: How to Enable and Use It on Windows 11
Sudo for Windows came with Windows 11 24H2. Turn it on in Settings, then run elevated commands from a normal terminal. Not available on Windows Server.
-
PowerShell Tail: Get the Last Lines of a Log File With Get-Content
Get-Content -Tail shows the last lines of a log file, the PowerShell answer to the Linux tail command. Plus a Tail function that colours errors and warnings.
-
PowerShell Script: List Files with Sizes and Dates
In this blog post, we’ll go through the steps for using a PowerShell script that lists files in a directory along with their sizes and creation dates. This…
-
Get-WUList Is Not Recognized: Install the PSWindowsUpdate Module
"Get-WUList is not recognized as the name of a cmdlet" means the PSWindowsUpdate module is not installed. Install-Module fixes it on Windows PowerShell 5.1, no PowerShell 7 upgrade needed.