It is time for your next PowerShell scripting challenge. If you are new to these challenges, please take a few minutes to browse past challenges. There is no time limit. This is not a contest. If you find a challenge, you are invited to try your hand. Submit links to your solutions in the comments.
Now on to the new PowerShell scripting challenge.
The Chairman realizes that for many people, learning and looking at PowerShell can be confusing. Sometimes, it can feel as if it doesn’t make sense. For this challenge, The Chairman wants you to intentionally not make sense.
This exercise is being classified as an Intermediate challenge. The Chairman expects more advanced users to develop more sophisticated code with advanced PowerShell scripting features such as parameter validation and error handling. The challenge consists of 4 discreet goals, which build upon the previous task.
Using PowerShell code:
- Create a random, nonsense “word” of a user-specified length, such as ‘jhmoz’
- Create a sentence of nonsense words of a user-specified length. Words should be of varying lengths.
- Create a paragraph of nonsense sentences, of varying lengths.
- Create 10 sample document files of varying paragraph length.
- Sentences should start with an upper case letter and end in a period.
- Insert punctuation into your sentences such as commas, exclamation points, and semi-colons.
- Include letters with diacritical marks such as an ?.
- Create a command to create a nonsense markdown document.
As with all these challenges, you are invited to share links to your work in the comments.
11 Replies to “A PowerShell Nonsense Challenge”
I hope I have covered all the points in the Intermediate level and first 3 points in the extra credit, and here’s my script…
And the 4th point in the extra credit is not striking in my mind, any hint would help.
That looks nice. The fake markdown document should just be a matter of creating sentences with markdown formatting. You should be able to at least generate fake headings.
Thanks Jeff, I have added the command to generate markdown file as well, it’s not only the header but also added few more elements as well.
Thanks for the hint and here’s the complete script…
Great use of (Get-Culture).TextInfo.ToTitleCase(). I can’t say I ever thought of this. Nice work.
My first ever submission to Iron Scripter and I had a blast. Each of the intermediate and extra credit points should be covered. I placed it all in a module called NonsenseCreator in Github.
Hi! Here is my solution for this challenge with markdown generator:
I’ve finally (and mostly) completed this challenge. I’m sure I’ve done something similar on the Commodore 64 or PET back in the day, but sadly I couldn’t find my code.
Here’s my solution with an explanation in the README.md.
Hey Dave. Love your ReadMe and your code. I’m going to take a few notes on your ReadMe especially to improve the reader’s experience. It is interesting that you chose to go with a letter weight based on a sampling of English. It appears that was enough to give you a general vowel-consonant transition within words. I aimed for a that as well, though I used a slightly different approach. I’ll update my ReadMe to explain this a little more on mine. Nice work!
Here’s my write up with links to the GitHub repo: https://jdhitsolutions.com/blog/powershell/7638/friday-fun-a-powershell-nonsense-challenge/
Did it live in UNT’s PowerShare meeting.
Comments are closed.