One of the challenges with condensing workstation task sequences into a single task sequence is being able to distinguish between desktops and laptops as each typically has their own set of functions to perform when being imaged. One of the best ways to determine this is by querying ChassisTypes in Win32_SystemEnclosure. Unfortunately, ChassisTypes is an array value; the WQL that is used in the task sequence is limited to single values.
To work with this, add the following vbscript to a Run Command Line task. It creates a custom Task Sequence variable that can then be used to dynamically limit certain tasks to “desktops” and others to “laptops”.
‘==========================================================================
‘ NAME: SMSTSEnvChassisType.vbs
‘ AUTHOR: Nick Moseley, SCCM Administrator
‘ DATE : 4/24/2009
‘ COMMENT: Script creates custom TS variable that can be used to distinguish
‘ between a desktop and a laptop for dynamically selecting which tasks
‘ to run in the sequence. Note that the echo statements are logged in SMSTS.log
‘==========================================================================


6 comments
Comments feed for this article
May 5, 2009 at 5:07 am
Maarten
Hi,
I’m trying to get this script implemented in one of my tasksequences but it keeps failing. Are you sure this is working? Tried pretty much everthing I can think of but unfortunately I’m no script guru so not really my place to argue ;)
I thought that maybe because you declare oTSEnvironment to contaign the TS variables (or that is what I think anyway) and then set the OSDImageType variable using oTaskSequence instead of oTSEnvironment?
any ideas?
thanks for your help
Maarten
May 5, 2009 at 6:58 am
Nicolas Moseley
Maarten – thanks for the advising me! Sorry about the confusion, I had pasted some old code. Plus I found that a copy/paste of the text messed up some of the characters. I’ve updated the code and changed the font. It should work now, but let me know if you continue to have issues.
June 15, 2009 at 11:08 pm
Umesh
Hi Nicolas,
I ma facing one strange issue with task sequence.
I have one captured image which use for OS deployment.
The task sequence was running perfectly till last week.
Now all of a sudden same task sequence with same settings is not working on same system on which it was running without issue.
After system reboots in a Win PE , it initialize the hardware and shows ” Windows is starting” message. After that it does nor proceed and does not show any thing except background image and system reboots after couple of minutes.
Please Help.
Regards,
Umesh
June 16, 2009 at 5:54 am
Nicolas Moseley
Thanks for the comment Umesh,
The problem you’re experiencing sounds like the disk drivers are not initiating or the disk is not being found within WinPE, so the system just restarts. Instead of using this blog as a location for troubleshooting further, I would like to invite you to post on MyITForum or on the Microsoft SCCM Forums as there are many people who can help you resolve this problem. You can find links on the left under “Forums”. I look forward to you joining the community!
p.s. Though Nicolas is my full name, I really only force my family to call me by my full name. You’re welcome to call me Nick :-) Unless you really really want to call me Nicolas, then that’ll work too…
October 20, 2009 at 5:51 am
Killragtshirts
Hi,
I use a custom TS variable script to grab chassis type and default gateway of the machine. However, the default gateway script does not seem to work in a TS environment. I know this because TS steps later in the build process don’t work when I have a default gateway variable assigned to the step. I noticed that you mention that the Echo statements are logged in SMSTS.Log….Is that writing to the log each time its processing the Echo statements? Im just trying to work out if I could do a similiar thing in my script to troubleshoot the process.
Thanks
October 20, 2009 at 6:42 am
Nicolas Moseley
Yep – every echo statement in the vbscript will appear in SMSTS.log – it is very useful for troubleshooting.