Scripting Wife Gives Hints for Beginner Event 8
Summary: Scripting Wife Gives Hints for Beginner Event 8
We just returned home from the SQL Saturday event in Atlanta. It was a great time, but it kept me busy. Prior to the speakers dinner, we met up with a couple of people from the Charlotte PowerShell Users Group. It was really fun going to another city and still seeing some of your friends from where you live. I guess you could say that the Charlotte PowerShell Users Group supported SQL Saturday in Atlanta in a big way. In fact, two of our members spoke during the Windows PowerShell track. Of course, one of those was the Script Monkey (aka. Ed Wilson), but the other speaker from Charlotte was Jim Christopher who is a Windows PowerShell MVP. All this is to let you know why I am slow in writing my tips for Event 8.
OK, this one sounds confusing. In fact, it sounds like there are conflicting requirements. How can I return a Yes or No from the script, but also return a bunch of other information? I will admit I had to ask Ed what he had in mind. He told me that he was thinking someone might want to write a script with two functions in it. One function returns the True/False (Yes or No) if the computer is a laptop, and the other function returns the inventory information (such as the computer name and that kind of stuff). I think it is a bit hard, but it can be done.
After he clarified that, it was not too hard. For the purpose of the task I assumed that we have either a desktop (tower or whatever) or a laptop. All types of portables, laptops, tablets, anything like that is a laptop for the scenario. There is a property in WMI that will tell you what type of computer you have.
Well that is all for now. I hope this helps.