Okay, I don’t mind telling you that I thought this particular event was a bit annoying. It was not that hard, it was just annoying. I do not think it is fair to have to find five pieces of information, and create a text file just for one event. I guess the problem is that I never liked word problems when I was in school. I did great when the problem was given to me, and I had to solve it, but when I have to read a book, figure out what the problem really is, and then solve the problem? Well, that is not fair. I mean, what if when I am reading the question I think, well that is not all that important and so I decide to leave it out. Or what if I make it more like real life–you may want all this, but you are only going to get about half of what you want. I mean that is what real life was like back when I was doing accounting work for a Fortune 500 company. In the old days, you might have wanted a computer that was able to do this, that, and some other thing, but you were lucky to get a computer that would boot up and run Excel. If you needed email, that would take either a different computer, or you would have to close Excel, reboot the computer, log back onto the network, and start the email program. At that point, you may as well have gone to lunch because it was going to take forever to get any email. I swear that interoffice mail using a courier was sometimes faster than our old email program. But I am going off on a tangent. Sorry.
My script took me about 30 minutes to write. What I did was search through the Hey, Scripting Guy! Blog archive. I looked for everything I was supposed to add to the file. I found environmental variables (you can get them from the environmental drive, $env) that gave me the user name, the computer name, and even the domain. To find the operating system information, I had to use WMI. I stored the results from each of these into variables. Now, here is the cool part–I used a here string to create the output that the Scripting Guy said I needed to display. I then used a cmdlet to write the information out to a file. This particular cmdlet gives me the ability to specify the ASCII encoding that was required.
Well that is it. Good luck. You have about three more days to upload Event 5 (April 15, 2001; 12:01 A.M. [-7 UTC].