2012 Scripting Games Beginner Event 8: Is Computer Desktop or Laptop?

2012 Scripting Games Beginner Event 8: Is Computer Desktop or Laptop?

  • Comments 33
  • Likes

 2012 Scripting Games badge

Summary: In Beginner Event 8, you are required to determine if a computer is a desktop computer or a laptop computer.

 

About this event

Division

Beginner

Date of Event

4/11/2012 12:01 AM

Due Date

4/18/2012 12:01 AM 

Event scenario

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.

Design points

  • For the purposes of this scenario, your script only needs to write to the console.
  • Your script only needs to determine laptop or desktop from a hardware perspective. You do not need to determine the version of the operating system.
  • Your code only needs to run on a local computer.
  • If your code requires admin rights, you should detect if the code is running as an admin or as a standard user. If your code works without requiring admin rights, you do not need to make this check.
  • Extra points for writing a simple function that only returns a Boolean value.

2012 Scripting Games links

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 scripter@microsoft.com, 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 

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • First "count the number of desktop computers and the number of laptop computers on the network" is stated and later "Your code only needs to run on a local computer."

    Perhaps something gets lost in the translation... but what is the goal here? Just one device or everything (remote?)?

    If all devices are the goal, then why the design point for only to run on the local computer?

  • I too am a little confused @Jeff Wouters.

  • I have my script ready to be submitted, but I think I will wait a bit. I hope someone can clear up the confusion (unless that's the point hehe). I'm keeping my fingers crossed for now.

  • I am bit confused too.....whether it needs to be run against remote computer(s) or as design point states only against local computer.

  • Looks to me like the script only needs to determine is the system is a laptop or desktop on the local system, we're not being asked to display a count as part of the challenge.  So to me it looks like we would be designing a "Proof of concept" something that shows we can determine the type of system for a larger inventory report.

  • Good point Michael.  It would help if that was clariried.  I looked at this as we need to tally the number of laptop and desktop computers which would be a chellenge given we are not in a domain (not stated in the scenario or design).

    Also, the scenario or design does not state what OS these machines are running because some WMI properties are not available on Server 2003, XP, etc.

  • @Jeff Wouters This script does not need to do the actual count -- it will provide the information you will use to make the count. I do not want to complicate your scripts by making you perform the actual remoting.  

  • @SoCalDavis yes ... it is always a good idea to think about the script a bit before hitting submit. Just like in REAL life, it is always a good idea to think and to test a bit before hitting run for your script that runs on a production network.

  • @Pradeep Rawat your script does not need to actually run on remote systems.

  • @Michael Moore Yes, great point. This is a proof of concept, that will be part of a larger system. You do not need to do the count, and therefore do not need to run against remote systems. The main point here is figuring out HOW to actually get the information.

  • @SdeDot NOW you are starting to get it! HOW can you reliably figure out if you have a laptop or a desktop computer!

  • sorry I'm a noob, what's a Boolean value

  • @Brad do not appologize for being a noob --- everyone was a noob at one time or other. I am glad you are using this time to learn PowerShell skills. So, a boolean value is True or False. On or Off. Exists or does not exist. Yes or No. Think like a light switch (not with a dimmer control) the lights are on or off. So here, returning a boolean would return a value that is TRUE if the computer is a laptop, or False if the computer is a desktop. Windows PowerShell has the $True and the $False automatic variables that correspond to Boolean values.

  • Is a mini Tower considered a desktop?   In our environment you either have a laptop or a desktop even if you can look at it and tell that it's a mini tower.

  • @KFred yes a minitower is considered a desktop for this scenario.