Catch and Store Error Messages in PowerShellWhen you are in a flow, nothing is worse than having to stop to deal with a console error message. It would be great if the errors could be handled by the script and packaged into helpful messages. Happily, PowerShell offers this capability to catch,...May 10, 2023·2 min read
How to install PowerShell modules on an offline computerInstalling powershell modules is simple, right? Open a powershell window and use the Find-Module cmdlet or if you know the name of the module go straight to Install-Module. This will connect to the PowerShell gallery and download and install the modu...Dec 1, 2022·2 min read
All about renaming files with PowerShellRenaming files is a common operation in windows, it’s simple enough to select a file and rename it using the context menu. But what if you have many files or need to automate file renaming? PowerShell reduces this operation to several simple commands...Dec 1, 2022·1 min read
How to compare file lengths with PowerShellAfter a file copy is complete, how can you be sure the entire file was copied? This can be done with the file length command in PowerShell. This will compare the length in bytes of each file and, combined with an if statement, is a way to perform rem...Dec 1, 2022·1 min read
How to check a Windows Service status with PowerShellPowerShell offers simple ways to perform administrative tasks such as checking the status of a service. This can be combined with an if statement to act on a stopped service automatically. These commands can be incorporated into a much larger script ...Nov 30, 2022·1 min read
How to remove files by last write time with PowerShellDrive space is a finite resource, ask any server administrator. No one wants to see the message, “No space on disk”, when you are trying to save that last document. How can you clean up files that you don’t need? As always, PowerShell makes it simple...Nov 29, 2022·1 min read
How to cast a string value as an integer in PowerShellWhen numbers are stored as a string in a database, it is difficult to sort them, so they are readable to human users. PowerShell makes this operation simple, to take a string value, cast it as an integer, sort it by numeric value and create an output...Nov 28, 2022·1 min read