PowerShell, Scripting
comment 1

ConvertTo-PowerShell: PowerShell versus “other” scripting examples – Part 5: List 20 largest files

In today’s post, I will show an example script to retrieve a 20 largest files on C: drive. As usual, we will first look at the VbScript example and then see a PowerShell “one-liner”.

VBScript

This VBScript uses log parser 2.2 COM object to make it easy and faster to get a list of largest files. It would be very tough to achieve this without log parser and using file system object. So, to be able to run this script, you must have log parser 2.2 installed on your system.

Now, let us see how we can do that in PowerShell without requiring log parser and in just one command.

This is it. It is simple and concise. That is the Power of PowerShell.

Filed under: PowerShell, Scripting

by

Ravikanth is a principal engineer and the lead architect for Microsoft and VMware virtualized and hybrid cloud solutions within the Infrastructure Solutions Group at Dell EMC. He is a multi-year recipient of Microsoft Most Valuable Professional (MVP) award in Windows PowerShell (CDM) and Microsoft Azure. Ravikanth is the author of Windows PowerShell Desired State Configuration Revealed (Apress) and leads Bangalore PowerShell and Bangalore IT Pro user groups. He can be seen speaking regularly at local user group events and conferences in India and abroad.