Scripting Wife’s Suggestions for Beginner Event 4

Scripting Wife’s Suggestions for Beginner Event 4

  • Comments 12
  • Likes

Summary: The Scripting Wife offers her suggestions for completing the PowerShell Scripting Games Beginner Event 4.

I want to get this done now. I am meeting some friends for breakfast, and I do not know when I will be back. Sometimes, at least with some friends, it takes nearly all day to have breakfast. Not that we eat all the time, but we go shopping afterwards. Being in the middle of the Scripting Games, I do not think we will go shopping all day, but then that is the great thing about having a week for an event—it lets me take a day off if I want to do so.

One thing I will say is that I like this year's events better than last year's. It is still hard, but I do not have to write a 100-line script (not that I ever did write a 100-line script...just saying). This event is no exception. My answer was a one-line script. That is right, I was able to do this in one line of code. And I actually thought this event was pretty easy. Here are my specific comments.

1. There is a cmdlet that specializes in comparing two different things. Use the Get-Command cmdlet and find that cmdlet. Next use Get-Help to show you how to use that cmdlet. Here is my super secret trick: When you use the Get-Help cmdletuse the –Online parameter. It will open up the latest Help from the TechNet site. This includes all the latest changes and fixes. The Help on the computer only gets updated with Service Packs, so it is not as up-to-date as the Help on the web.

2. We only need to compare file names. This means that you need to get a directory listing. Because the folders are not nested, you do not need to make your cmdlet that gets directory listings do a recursive search.

3. My one-line solution was pretty simple, so I meet the not very complex requirement. I also used native Windows PowerShell cmdlets. I hope I get five stars for my entry, because I do not know anything I missed. But you never can really tell.

Good luck to you. I need to run, so I will talk to you tomorrow. I hope you are enjoying the Scripting Games as much as I am.

~Scripting Wife

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Unfortunately I've already submitted my script for this event, but I've read and re-read the event and I don't see any mention of nested folders. The script also doesn't create a nested folder structure. Did I miss something?

  • @Jlsuperman You are right, the folders are not nested. I will tell her that she did not need to recurse. Of course, with a single directory it does not HURT anything, but yep, she did not need to recurse.

  • @jlsuperman. She states that you don't need to check for nested folder. Quote "Because the folders are not nested, you do not need to make your cmdlet that gets directory listings do a recursive search."

  • @bader_meinhof - It's been edited since jlsuperman made his comment.  It's now stated correctly whereas previously it said there 'were' nested folders.

  • can you compete in both advanced and beginner? I find the beginner event amusing and challanging, but the advanced gives interesting challanges to understand what else powershell can be used for.

  • @bader_meinhof - You can't sorry mate.  Iamred has made this point clear on a number of posts and has actively been deleting double submissions.  I suppose it's about being fair, if you're competent enough for the advanced tasks then you're putting us newbies at a disadvantage if you enter the beginner too.

  • @bader_Meinhof @Mr Killian is correct, you can only compete in one category either beginner or advanced. This was the way it was last year, and it is also mentioned in the FAQ for this year. Two years ago we did permit people to enter in both, but then it was not really fair for beginners because they could never achieve the same type of scores as the advanced scripters. So we limited it last year. Yesterday, the rule was implemented on PoshCode database that keeps you from submitting to both categories. This is why some people have gotten a "you already submitted" message. You are certainly free to write your own solutions to the events, and to compare them with those submitted and even to compare them with the expert solutions later on. I am glad you find the beginner events challanging and amusing.

  • @IamMred: Ahaa.. Sorry, my bad than.

    Last time i compete was in 2007 and i also checked the judging part but not the FAQ. I will read the FAQ and do my coding in the background. I'm not so much in for the competition, as long as i beat my coworker ;)

  • @Bader_meinhof ... that makes sense. Back then we did permit competing in both beginner and in advanced. But I got a lot of comments from people that a beginner NEVER had a chance to win. So I split out the leaderboard into beginner and in advanced, and make it so you could only enter one or the other. I also created a quiz on www.scriptingguys.com/learnpowershell to help people judge if they are a beginner or an advanced scripter.

  • I didn't have an issue with getting the information, but trying to format the output like the example was the tough part to me.  I couldn't figure out how to do it with just one line of code, but I know I have a lot to learn yet.

  • @Craig Jahnke Great. That is part of the fun of the Scripting games.

  • I figured out how to do it in one line, unfortunately it was after I made my submission.  

    Good thing I am in it to learn and not to win it.  I just lost some points on this one.