TechMentor is just around the corner (www.techmentorevents.com), and in preparation I’m partnering with the event’s producers to create a little Windows PowerShell challenge. Submit the best answer to my puzzle, and you could win an autographed copy of Windows PowerShell: TFM from SAPIEN Press (www.sapienpress.com), sponsor of my three-day Windows PowerShell hands-on workshop at TechMentor.
Entries are due by 03/11/2011. Here’s what you need to do to enter:
2. Post your entry in your blog. If you don’t have a blog, post your entry in the community PowerShell script repository at http://poshcode.org. Make sure there's some indication of how to reach you (if you're following me on Twitter @concentrateddon, I can DM you, otherwise make sure there's a "contact me" link or something in your blog)
3. Use Twitter to post a link to your entry. Make sure your tweet includes the hash tags #techmentor and #pshchallenge.
That’s it! Now, for the challenge. It consists of four separate, independent problems for you to solve:
PROBLEM 1: My company.com domain has an OU named Database Servers. The OU contains just five computer objects, and each computer runs a service named DataServer. I need a quick way to change the password that the DataServer service uses to log on.
PROBLEM 2: I have a text file named FileServers.txt, which contains the names of several file servers, listing one server name per line. I need to get a disk inventory report for those servers’ local hard drives. I want the report in table format, and I want it to list the server name, drive letter, amount of free space, total size, and percentage of free space. I only want to see drives that have less than 20GB remaining.
PROBLEM 3: I need to query every computer in Active Directory. For each computer, I need to see its name, Windows version number (e.g., “7600” for Windows 7 pre-SP1), BIOS serial number, and service pack version. I want to be able to export this information to a CSV or HTML file, and I want to be able to filter so that only computers on a certain Windows and service pack version are included. My filter criteria will change from day to day.
PROBLEM 4: I have a CSV file named Users.csv. It contains four columns: Department, Title, Username, and City. I need to use this file to create new users in Active Directory. For each new user created, I need to add them to a group called “Employees.” The user objects can be created in the default Users container, and the Employees group already exists and is located in the Users container. It’s okay to create these with a blank password – the new users will call the Help Desk on their first day of work to have a password set.
You’ll stand a better chance of winning if you follow these guidelines:
- Shorter is better – one-liners will score higher than a script. That said, be sure to use complete cmdlet and parameter names – no aliases, no abbreviations. It’s okay (and recommended) to use size aliases like KB and MB.
- If you choose to solve a problem by writing a script, know that a function will score higher. Advanced functions will score even higher, and adding frills like comment-based help, pipeline parameter binding, and so on will score highest.
- It’s safe to assume that any core Windows technology will work. That includes WMI.
The fine print:
The winning entry will be determined at the sole discretion of Don Jones. In the case of duplicate or similar entries sharing equal technical merit, the first entry received will be deemed the winner.