Look for the kixomatic in the COM scripting forum. It will help you to generate code.
Maybe this link can also help:
Hey, Scripting Guy! How Can I Determine if a Computer is a Laptop or a Desktop Machine?