Challenge

Building More PowerShell

The Chairman hopes that people have been working on the recent set of challenges. They were designed to meet the needs of all skill levels. The Chairman does not want IT Pros and PowerShell fans to think these challenges are only for advanced and experienced people. You can’t become advanced and experienced without using PowerShell.

Assuming you have accomplished the goals in the previous challenge, the next challenge will build upon your previous work. The Chairman has identified a set of tasks for each skill level. Of course, you are welcome to tackle as much as you want.

Beginner

  • Modify your function to include hidden files in your totals. You probably will need to revise your function.
  • Add an alias for your command.
  • Format your total size value as KB.
  • Add as many intermediate features as you can.

Intermediate

In addition to all of the beginner challenges, add the following features to your solution.

  • Verify that the path belongs to the file system.
  • Display a progress bar while analyzing each folder.
  • Display hidden file results in the same object but as separate properties, i.e. count and total size
  • Format the average size to 2 decimal places.
  • Add as many advanced features as you think you can.

Advanced

In addition to all the above requirements, add the following features to your function. You may decide to begin creating a module.

  • Add a parameter to exclude more than one file extension.
  • Add a custom type extension to show total size and average in KB.
  • If you create a module, include a MAML-based external help file.
  • Create a custom formatting view that displays these properties as a table:
    • Computername
    • Path
    • Total files
    • Total file size in KB
    • Date

Your Time Starts Now!

Remember, please don’t submit any code solutions as comments. But you are encouraged to share links to your work and collaborate with others. These challenges could be a fun coding exercise for your next user group meeting. Everyone learns when everyone works together.

Leave a Reply

Your email address will not be published. Required fields are marked *