2013 Scripting Games: Advanced Event 3
Summary: Scripting Games Advanced Event 3: Dr. Scripto needs to create an HTML report for hard disk drive status.
Microsoft Scripting Guy, Ed Wilson, is here. Today is the release of Event 3 for the 2013 Scripting Games. This year the Games are being administered and run by www.powershell.org. You need to go to their website to submit your entry.
A Disk Decision
Dr. Scripto has been fielding a lot of calls from the Help Desk lately. They’ve been asking him to look up information about the local hard drives in various servers—mainly size and free space information. He doesn’t mind helping, but all the requests have been getting in the way of his naps. He’s asked you to write a tool command that can get the information for the Help Desk—and he wants the output in an HTML file. The HTML file should look something like this:
The Doctor says that you should parameterize your command. He wants to be able to pipe one or more computer names as strings. The resulting HTML needs to go into an HTML file on disk someplace, and that file should have the computer name (for example, the computer SERVER1 should have Server1.html, SERVER2 should have Server2.html, and so on). A parameter should let him indicate the path (directory) to write the files to. Also, he wants you to pay special attention to the following:
- The browser displays “Disk Free Space Report” in the page tab when viewing the report.
- “Local Fixed Disk Report” is in the Heading 2 (H2) HTML style. If you can add the computer name to that, bonus!
- The report ends with an HTML horizontal rule and the date and time that the report was generated.
- The size and free space values are shown as gigabytes (GB) and megabytes (MB) respectively, each to two decimal places.
The command you write can assume that both WMI and CIM are available on the remote computers, and that all the necessary firewall rules and authentication have already been taken care of.
I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at email@example.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.
Ed Wilson, Microsoft Scripting Guy