Archive for April 27th, 2009
MMS 2009 – Day 1
Posted by N. Moseley in Miscellaneous Ramblings on April 27, 2009
Just completed day 1 of the Microsoft Management Summit. My biggest takeaway from the day is the realization of how simple PowerShell can be to learn, and how useful it can be for automating tasks or getting dynamic system information that isn’t natively possible in SCCM (like getting active process usage throughout the day and exporting to a .csv file). PowerShell can easily be used to gather information for short term tasks rather than extending SCCM inventories (which would need to be a long-term investment). Additionally, PowerShell can still be used to create COM objects (like WScript.Shell in VBScripting) to accomplish tasks, which will help in the transition.
I also had a brief opportunity to talk with a couple of people with MyITForum (one being the great Rod Trent). Hope to be able to run into some more. Especially hoping to meet some of the MVPs in the SCCM realm!
Looking forward to day 2!
Handling Chassis Types In SCCM OSD
Posted by N. Moseley in ConfigMgr 07, Scripting on April 27, 2009
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
'==========================================================================
Dim oTaskSequence, oWMI, colChassis, sChassisType, oChassis
Set oTaskSequence = CreateObject ("Microsoft.SMS.TSEnvironment")
Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colChassis = oWMI.ExecQuery("Select * from Win32_SystemEnclosure")
For Each oChassis in colChassis
For Each sChassisType in oChassis.ChassisTypes
Select Case sChassisType
Case 8
Wscript.Echo "Chassis Type: Portable"
oTaskSequence ("OSDImageType") = "laptop"
Case 9
Wscript.Echo "Chassis Type: Laptop"
oTaskSequence ("OSDImageType") = "laptop"
Case 10
Wscript.Echo "Chassis Type: Notebook"
oTaskSequence ("OSDImageType") = "laptop"
Case 12
Wscript.Echo "Chassis Type: Docking Station"
oTaskSequence ("OSDImageType") = "laptop"
Case Else
Wscript.Echo "Chassis Type: Unknown"
oTaskSequence ("OSDImageType") = "desktop"
End Select
Next
Next


Recent Comments