How to Delete Files Older Than X Days in PowerShell?

Delete Files Older Than X Days in PowerShell

If you want to maintain and organize files, then it is good to regularly delete files that are no longer needed, specifically files that are older than a certain number of days. In this tutorial, I will show you how to delete files older than X days in PowerShell. To delete files older than a … Read more

How to Get File Name Without Extension in PowerShell?

Get File Name Without Extension in PowerShell

Recently, one of my clients asked me to write a PowerShell script to find file names without extensions in a folder. I tried different methods. In this PowerShell tutorial, I will explain how to get file name without extension in PowerShell using several methods. To get the filename without the extension in PowerShell, you can … Read more

How to Create an Empty File in PowerShell?

Create an Empty File in PowerShell

Do you need to create an empty file in PowerShell? This is a very common requirement for PowerShell administrators. In this tutorial, we’ll explore different methods to create an empty file using PowerShell. To create an empty file in PowerShell, you can use the New-Item cmdlet with the syntax New-Item -Path .\example.txt -ItemType File, which … Read more

How To Get Newest File In Directory In PowerShell?

Get Newest File In Directory In PowerShell

My client wanted to do some file operations on the newest file in a directory. So, I used various PowerShell methods to get the newest file in a directory in PowerShell. To get the newest file in a PowerShell directory, you can use the Get-ChildItem cmdlet combined with Sort-Object. For example: This command retrieves the files in the … Read more

How to Create a Password-Protected Zip File Using PowerShell?

Create a Password-Protected Zip File Using PowerShell

Recently, one of my clients asked me to create an encrypted zip file. I tried PowerShell. In this PowerShell tutorial, I will show you how to create a password-protected zip file using PowerShell. To create a password-protected zip file in PowerShell, you can use the Compress-Archive cmdlet combined with a third-party tool like 7-Zip. Here’s an example … Read more

How to Split Large Text Files with PowerShell?

Split Large Text Files with PowerShell

When working with large text files, it can be necessary to split them into smaller files. This is a common requirement while working with log files. PowerShell provides different commands and methods to divide these types of large files. In this tutorial, we’ll explore different methods to split large text files using PowerShell. To split … Read more

How to Check if a File is Empty with PowerShell?

Check if a File is Empty with PowerShell

Are you looking to check if a file is empty or not in PowerShell? In this PowerShell tutorial, I will show you different methods to check if a file is empty with PowerShell. To check if a file is empty in PowerShell, you can use the Get-Item cmdlet to retrieve the file’s properties without loading its content. … Read more

How to Check if an Array is Empty in PowerShell?

Check if an Array is Empty in PowerShell

Do you want to check if an array is empty in PowerShell? In this blog post, we’ll explore various methods to check if an array is empty in PowerShell. To check if an array is empty in PowerShell, you can test if the count of the array is zero by using $array.Count -eq 0. If … Read more

100 PowerShell cmdlets download free

100 POWERSHELL CMDLETS E-BOOK

FREE Download an eBook that contains 100 PowerShell cmdlets with complete script and examples.