Scripting Games: event 1–use of robocopy

The object of the exercise in both the beginners and advanced sections of event 1 was to move a set of log files older than a give data to an archive folder.

A number of solutions were presented that used robocopy.

This is a workable solution that meets the lettter of the objective but it doesn’t really meet the spirit of the games.

The Scripting Games is about learning to use PowerShell.  Within PowerShell there is a move-item cmdlet.

Robocopy isn’t required. Using non-Powershell tools can often be harder than using PowerShell.  In your work, and especially in the games, think very carefully before reaching for a non-PowerShell command


And its not PowerShell!

This entry was posted in Powershell, Scripting Games. Bookmark the permalink.

2 Responses to Scripting Games: event 1–use of robocopy

  1. luesec says:

    I have a different opinion on using Robocopy for Event. I used it deliberately and see it as a really advanced submission because i showed that i learned something and wanted to share this with others: I really like Powershell and i am still impressed that it seems there is nothing you can’t do with it. But sometimes there is just a better/easier Solution for a Problem. I also saw many questions in Forums people were asking how to solve xyz in Powershell where there is just a well written & tested Tool for it. And it didn’t seemed they just were asking because they wanted to learn sth. but just wanting to solve a task. We have Nmap for Portscanning, OpenSSL/Makecert.exe for Certificates, … and Robocopy for copying Files.
    I took the Advanced Track but when i read that for the Beginner Track a Oneliner would be nice i really thought the Jury want’s to see the easiest, shortest, and most robust solution, with retry options Errorhandling Logging and so on.

    & Robocopy.exe “$sourceFolder” “$destFolder” *.log /S /mov /MINAGE:90 /R:1 /W:1 /LOG:$RobocopyLogfile

    I am aware that this are Powershell Scripting games and i think with my submission i showed as well some interresting things what you can do with PS around a Robocopy Call (Exit Codes, Logging to Eventlog)
    These can be useful when you have other 3rd Party Apps you’re dependend on.
    Hope you get me right. I’m totally ok with your opinion as well with the few comments I got.
    For me, the Spirit of the Games is to learn and see solutions I have not thought of. And I bet there are a few out there who haven’t thought of Robocopy 😉

    • Thanks for your comment. I appreciate you taking the time to respond.

      Would I use robocopy to complete a task in production – yes I would. I’ve used it in the past and will use it again especially when I want to log what is happening and have the ability to restart after failures.

      The point I was trying to make was that using robocopy steps outside the spirit of the games in my opinion.

      Using non-PowerShell tools in PowerShell is a viable option and we devoted some time to it in PowerShell in Depth.

      My preference in the games is always to see a PowerShell solution – the events are designed to have a PowerShell solution. The primary function of the games is to teach people how to use PowerShell.

      Good luck in the rest of the games

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s