Learn about Windows PowerShell
Summary: In Beginner Event 8, you are required to determine if a computer is a desktop computer or a laptop computer.
About this event
Date of Event
4/11/2012 12:01 AM
4/18/2012 12:01 AM
You are the desktop manager at a midsized enterprise company. It is inventory time, and you need to get a count of the number of laptop computers and the number of desktop computers. You decide to write a Windows PowerShell script that will count the number of desktop computers and the number of laptop computers on the network. To permit auditing, your report should include the computer name, and whether or not it is a desktop or a laptop machine.
2012 Scripting Games: All Links on One Page
I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at firstname.lastname@example.org, or post your questions on the Official Scripting Guys Forum. Good luck as you compete in this year’s Scripting Games. We wish you well.
Ed Wilson, Microsoft Scripting Guy
For this scenario, should we consider only "laptops" as laptops and all others as desktops?
DavidW Laptops, portable PC's, Tablets, anything like that can be considered to be a "laptop" for this scenario.
@Brad This link may be helpful concerning Boolean values...
Should we handle Virtual Machines or disregard them?
How are we supposed to handle returning both a computer name as well as a boolean value. Are 2 lines of output acceptable as this is proof of concept?
@SteveH Virtual machines are not part of the scenario, but you could add that if you find it helpful.
@Matt Tilford, I would handle it as adding a switch to a function (or to the script) One output displays the true / false if it is a laptop, and the other displays the two pieces of information called for in the scenario. This is why I did not show a picture because there are two ways to write this, or three ways if you count a combined scripted output.
Should the function run itself at the end of the script or is just having the function enough to satisfy the criteria?
@Scott it is generally better that a function does not run itself.
For this event are Portables considered Laptops?
if were are look for laptop or desktop but the resualt is the be $true or $false. how is this displayed? we have 3 different thing that we are looking at (desktop, laptop and others) does that mean you want an output like
or am I missing somthing
After now seeing all events, I have to say that this one has been the most fun! I really enjoyed it, and had a great experience throughout!! Thanks to Ed, all judges, and all sponsors for allowing this event to happen! Already can't wait for next year! :)
Bit confused about which method to use! Been reading online and made me more confused!!! Since it it not mentioned we should consider that our script has to support operating systems like Windows XP etc?
Question number 2: is it safe to asume that if a computer is not laptop then it is desktop or vice versa? Am i asking that because of the function that needs to return a boolean value.
The given information is very effective.
i will keep updated with the same.
<a href ="www.sweetball.in/">industrial automation training